How to sort a table based on a UI field that is displayed on the table?
My requirement is to sort the records of a table on the SKUID page in descending order, based on a UI only field(Age field, as shown in the screenshot):

I have tried adding the UI only field ID in the "Fields to order records by" on the Model level, which throws an error:

The error:

I have also tried adding an Event for sorting the model, when the Skuid page is rendered, as shown in the screenshots:


This works when the page is rendered, but in my case the page is loaded twice to activate the "SLS I" and "SLS II" buttons on the page, as shown. Due to this, the records are unsorted again when the page finally loads.
Screenshot 1: When "M0Stip" tab is clicked on the Skuid Page, it returns the table with records sorted based on Age field (the actual requirement):

Screenshot 2: The Skuid page is reloaded automatically to activate the "SLS I" and "SLS II" buttons, which is an existing functionality, which results in records being unsorted again:

My requirement is to let the records be sorted based on Age in descending order, whenever the "M0Stip" tab is clicked on the page.
Any help with the same?
Thanks,
Sejal Bhatt.
I have tried adding the UI only field ID in the "Fields to order records by" on the Model level, which throws an error:
The error:
I have also tried adding an Event for sorting the model, when the Skuid page is rendered, as shown in the screenshots:
This works when the page is rendered, but in my case the page is loaded twice to activate the "SLS I" and "SLS II" buttons on the page, as shown. Due to this, the records are unsorted again when the page finally loads.
Screenshot 1: When "M0Stip" tab is clicked on the Skuid Page, it returns the table with records sorted based on Age field (the actual requirement):

Screenshot 2: The Skuid page is reloaded automatically to activate the "SLS I" and "SLS II" buttons, which is an existing functionality, which results in records being unsorted again:

My requirement is to let the records be sorted based on Age in descending order, whenever the "M0Stip" tab is clicked on the page.
Any help with the same?
Thanks,
Sejal Bhatt.
1
Categories
- 7.9K Questions
- 926 Ideas
- 220 Discussion Categories
- 178 General
- 9 Community Feedback
- 3 Community Info
- 18 Knowledge Base
Comments
Thanks for the reply!
This works for my case, but I found another way to work on the same:
I tried adding "Sort Model" in "Actions" for the tab which leads to this Skuid page, which sorts the records as expected, on loading the page.
But, after applying filters, i.e., clicking on "SLS I" or "SLS II" buttons on the page, the records get unsorted again.
I am trying to add actions on model level for the same, which is not working for my requirement as of now. So, I have placed a "Sort by Age" Global action on the page, as visible in the screenshot. I am still trying to find out a better way to make it work with filters.
Any help will be appreciated.
Thanks,
Sejal.
What happens now is something roughly like this:
- When they open the tab, your sort actions happens
- Table gets sorted by Age
- They choose a filter, model gets requeried as part of filtering
- When querying, it uses the last known server side sorting (in your case, the M0_Approvals_Request... info in the Fields to order records by property)
If a sort button will do the trick, that's a great solution to give users. If it needs to automatically sort by the UI field whenever its queried, then you need to have some actions in the Model Requeried area to handle sorting. As far as I know, it's the only way to ensure it happens every time the model is queried.Sorting on UI-Only fields has always been tricky, I typically only do so when we're using a table with model lookup UI formula fields.
Thanks for the reply and apologies for the late response!
About Actions when model is requeried, I tried the solution, but the filter gets applied after the model is queried. So the sorting logic gets overwritten and the records get unsorted again.
The SFDC formula field works for my case.
Thanks!
Sejal.