Change the order of Graphic View screens
-
Hi,
I need to change the order (or the viewID) of my screens in Graphic View module. I use Mango 2.7.2.
Is there any way to do this? I remember, in previous versions, if I made any change on a specific screen, it was saved in the first position...
Thanks in advance!
-
Hmm. It's not particularly easy, but I think it is possible.
One way would be to export a view, delete it, and then this would move it to the bottom of the list.
An easier option is to modify Mango/web/modules/graphicalViews/web/views.jsp and adding something like this before the closing </tag:page>
//Code taken from googling "sort option elements javascript" // but adapted for $ meaning dojo var newOptions = jQuery(".borderDiv select option").sort(function(a,b){ if (a.text.toUpperCase() > b.text.toUpperCase()) return 1; else if (a.text.toUpperCase() < b.text.toUpperCase()) return -1; else return 0; }); jQuery(".borderDiv select").empty().append(newOptions);
-
Hi Phil!
I did what you suggested, I added the code to the end of the file. It works correctly, the views are in alphabetic order now.
However, the view-selector drop-down menu works incorrectly. The selected view is not the view I can see on the webpage (but the last one). The result is that I cannot select the last view, because the list "thinks" that this is selected already.Could you please fix this for me?
Thank you! -
Hi gbodacs,
Change
jQuery(".borderDiv select").empty().append(newOptions);
to
jQuery(".borderDiv select").empty().append(newOptions).val("<c:out value="${currentView.id}"/>");
-
Thank you, it works in my sandbox Mango environment! :) You just saved me 4 hours of exporting-textediting-deleting-importing-testing nightmare!
Thanks again!