Jump to content
  • 0

Sort by value instead of display inside a report


Philippe

Question

In the report below the Sponsor Type dropdown is sorted based on the value of the SponsorTypeID and not its display value. This is working fine. Now I would like the report itself to sort based on the SponsorTypeID as for the dropdown but show the display value  which is SponsorType. I could probably rename my SponsorType like 0 - Platinum, 1- Gold, 2- Silver and so on, but I think this is ugly and looking for a better solution.
Thanks

1130191266_Screenshot2019-06-08at16_33_50.thumb.png.e034457c7bd9bf8047b9dc4acd80e285.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

@Philippe

Also, I have found the JS workaround for your case.
You can use your approach with prefixes to sort the Display Values and then slice this prefix.
Example:  01Platinum, 02Gold...

Here is the code:

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
 document.querySelectorAll('.cbResultSetGroup1LabelCell').forEach((element)=>{
  element.innerHTML= element.innerHTML.slice(2);
 });
});
</script>

The thing you need to change is the Class element value within .querySelectorAll() function.

Please find the test app with the same logic implemented attached.New_Application_1_0_2019-Jun-20_0731.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...