Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Entity List - Column Sort

Posted on by 75

Hi All

I have created a Webpage in portal, added a entity list pointing to a view. 

It has multiple columns that are set to be Sortable. How can Stop one column to be Non Sortable.

Because my Id is a alphanumeric , when the user sorts it on ID the sort goes wrong so I want the users to not be able to sort the column.

I want to stop sorting happening on Project ID.

pastedimage1587990546742v1.png

Thanks in Advance.

  • oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Entity List - Column Sort

    oh that makes sense, sorry about that I didn't test it too much

    yeah your variable works fine, other way would be retrieve the column by the name instead of the 0 index, but that's okay what you did

  • Suggested answer
    bik@inturi Profile Picture
    bik@inturi 75 on at
    RE: Entity List - Column Sort

    Thank you so much.  This works.

    The only issue I found was that when you sort on another column, that column sort gets disabled and so on.   So i improvised and put a variable to do this only for the first time  and not do it again.

    IT has done the job .. Thank you

  • Suggested answer
    oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Entity List - Column Sort

    hi @cchannon

    I think actually you might be getting a bit confused with D365 changes to DOM

    this is not about removing the sort from D365 application, but instead it is the Power Apps Portal

    there is no really definition for supported or unsupported front-end customization in regards the Portal

    also, at the moment we cannot embed PCF controls there, hopefully this will come soon

  • cchannon Profile Picture
    cchannon 17 on at
    RE: Entity List - Column Sort

    While technically valid, Oliver's code above is not a supported customization so anyone that takes that approach should be aware it might break as a result of future updates. 

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-javascript#do-not-access-the-dom

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-javascript#do-not-use-jquery-for-form-script-or-commands

    That said, the only alternative I can think of would be to build your own grid as a PCF control or web resource, and there is almost no chance that much work is worth it for such a small requirement. So, if sorting on parent entity attribute is non-negotiable, then sometimes an unsupported customization is your only reasonable answer.

  • Verified answer
    oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Entity List - Column Sort

    the closest to an OOB configuration would be having your id on a parent entity and display that in your view

    by default in CRM we can't sort on the parent entity attributes

    but you can also achieve that via JS/Jquery, the below code can be place in your Entity List options/Javascript section

    what I am doing here is retrieving the first column, removing the "sort" arrow, getting the column title and replacing it for a new <span> element

    $(document).ready(function () {
    
        var list = $(".entitylist.entity-grid").eq(0);
    
        list.on("loaded", function () {
    
            var idColumn = list.find("table thead th a").eq(0);
            idColumn.find("span").remove();
            var columnName = idColumn.text();
            var newElement = ""   columnName   "";
            idColumn.replaceWith(newElement);
        });
    });

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans