none
Sort entity list in the MDS(2016) explorer RRS feed

  • Question

  • Hi, How can I sort the entity list in MDS 2016 explorer. I always thought the list of entities are alphabetically sorted in the explorer. However, to my surprise, it looks like they are not? Please help me fix this issue. Eg. I currently have entities showing as xyz, abc, lmn, iop. I want them to be listed as abc, iop, lmn, xyz. Thanks in advance

    Thursday, June 30, 2016 4:09 PM

Answers

  • There is a workaround for this, it is possible to modify Scripts\ViewModelExploreBase.js file in MDS web application so that all menu items will be sorted. This worked for me.

    Thanks,

    Thursday, September 1, 2016 11:01 AM
  • Hi torpo, you need to do following in ViewModelExploreBase.js file.

    1. Add below function before the "var entitiesMenu = new menuViewModels.MenuItem(resources.Explore_Index_Entities, []);" string:

    function compare(a,b){
                if( a.Name.toLowerCase() > b.Name.toLowerCase()){
                    return 1; 
                }             
                else if(  a.Name.toLowerCase() < b.Name.toLowerCase() ) {
                    return -1;
                }
                return 0;                   
            }

    2. Do following updates (this -> with this):

    entitiesMenu.MenuItems(entityMenu); -> entitiesMenu.MenuItems(entityMenu.sort(compare));

    collectionsMenu.MenuItems(collectionMenu); -> collectionsMenu.MenuItems(collectionMenu.sort(compare));

     dependenciesMenu.MenuItems.push.apply(dependenciesMenu.MenuItems, dependencyMenu); -> dependenciesMenu.MenuItems.push.apply(dependenciesMenu.MenuItems, dependencyMenu.sort(compare));

    That's it, hope this helps.

    Regards,

    Friday, November 4, 2016 9:16 AM
  • Hi VArdan.

    It worked but only in IE. So Chrome has to be left out


    /torpo

    Tuesday, November 8, 2016 7:27 AM
  • Just following up to report resolution.  I have also been using Chrome, so I opened explorer in IE and still found the poor entity order.  I then clicked each of the drop downs (Entities, Entity Dependencies, Hierarchies, Collections, Changesets) and after going back to Entities I found the entities in alphabetical order.  I then went back to Chrome and found the alphabetical sort order in Chrome as well.  This behavior seems quirky but it works nonetheless.  Thank you for the workaround!!

    Cheers,

    JasonVL

    Tuesday, November 8, 2016 3:12 PM

All replies

  • Hi guys, I am still waiting for some help. Alternatively, have you got any suggestions? Thanks

    MDS_2016

    Tuesday, July 5, 2016 11:43 AM
  • You can try sorting it by prefixing your entity with a number . Like 01_Emp,02_Address
    • Proposed as answer by Abhishek_300 Tuesday, August 2, 2016 2:01 PM
    Thursday, July 28, 2016 3:05 PM
  • Thanks for your reply Abhishek. I have moved to a different project and hence cant try this in the same environment. But, when I get some time, hope to replicate the issue and give a try on my laptop.

    MDS_2016

    Friday, August 5, 2016 6:26 PM
  • Hi everyone, I also have the same issue. Seem the system takes the sort order from mdm.tblEntity, where the ordering is based on PK (ID). I couldn't find any workaround for this at the moment. 

    Could anyone help with this?

    Thanks,

    Thursday, August 25, 2016 2:20 PM
  • There is a workaround for this, it is possible to modify Scripts\ViewModelExploreBase.js file in MDS web application so that all menu items will be sorted. This worked for me.

    Thanks,

    Thursday, September 1, 2016 11:01 AM
  • Hi Vardan. Can you share your alterations in the js file?

    /torpo

    Friday, November 4, 2016 8:56 AM
  • Hi torpo, you need to do following in ViewModelExploreBase.js file.

    1. Add below function before the "var entitiesMenu = new menuViewModels.MenuItem(resources.Explore_Index_Entities, []);" string:

    function compare(a,b){
                if( a.Name.toLowerCase() > b.Name.toLowerCase()){
                    return 1; 
                }             
                else if(  a.Name.toLowerCase() < b.Name.toLowerCase() ) {
                    return -1;
                }
                return 0;                   
            }

    2. Do following updates (this -> with this):

    entitiesMenu.MenuItems(entityMenu); -> entitiesMenu.MenuItems(entityMenu.sort(compare));

    collectionsMenu.MenuItems(collectionMenu); -> collectionsMenu.MenuItems(collectionMenu.sort(compare));

     dependenciesMenu.MenuItems.push.apply(dependenciesMenu.MenuItems, dependencyMenu); -> dependenciesMenu.MenuItems.push.apply(dependenciesMenu.MenuItems, dependencyMenu.sort(compare));

    That's it, hope this helps.

    Regards,

    Friday, November 4, 2016 9:16 AM
  • Thanks

    Will try it out


    /torpo

    Friday, November 4, 2016 9:46 AM
  • Hi Vardan,

    I'm also facing this issue.  I completed the steps you listed above (thank you for providing them), however, the issue unfortunately persists.  I also used the 'Refresh cached information' link at the bottom of the MDS home page but that didn't help either.  Please let me know if you have any other suggestions or if there are any other changes to the ViewModelExploreBase.js file that you think might help.  Thank you in advance for any help you can offer!

    Cheers,

    JasonVL

    Monday, November 7, 2016 10:06 PM
  • Hi VArdan.

    It worked but only in IE. So Chrome has to be left out


    /torpo

    Tuesday, November 8, 2016 7:27 AM
  • Just following up to report resolution.  I have also been using Chrome, so I opened explorer in IE and still found the poor entity order.  I then clicked each of the drop downs (Entities, Entity Dependencies, Hierarchies, Collections, Changesets) and after going back to Entities I found the entities in alphabetical order.  I then went back to Chrome and found the alphabetical sort order in Chrome as well.  This behavior seems quirky but it works nonetheless.  Thank you for the workaround!!

    Cheers,

    JasonVL

    Tuesday, November 8, 2016 3:12 PM
  • Thanks so much Vardan -- this fix worked. Awesome!

    Bill Faley

    Tuesday, February 7, 2017 10:39 PM
  • I applied the fix to the .js file and the sorting was still not correct in the IE. Then I cleared the Internet cache. Also note that we need to uncheck the 'Preserve favourites websites data' checkbox while clearing the cache (if this url was already added in the favourites). And it worked.

    Thank you all. Cheers!

    Anooj

    Thursday, April 6, 2017 5:02 AM
  • Thanks much Vardan! Upgrading large MDS model of over 100 entities, sort on entities is crucial. Saw they fixed it for SQL Server 2017, but  should come in a CU\SP for 2016 also. Anyway, thanks much!
    Monday, September 4, 2017 1:31 AM
  • I think I backported it please check it in latest SQL 2016 SP1 Cu4 release and you should see the entities, entity dependencies, hierarchy should be already in sorted order .
    Wednesday, September 6, 2017 7:40 AM
    Moderator
  • Hello Vardan - I applied this fix but weird thing is if I open IE from the MDS server I get the Entities sorted however from my desktop if I open IE and connect to MDS URL it is not showing as sorted  .I did clear the cache in IE but did not help  .Any suggestions .

    Thanks

    Priyanka


    KSH

    Thursday, July 18, 2019 10:10 PM
  • I tried to reset IIS and now I do see it in sorted out from IE browsed outside the server.

    KSH

    Thursday, July 18, 2019 10:14 PM