How to sort a model based on UI only formula field value?

edited December 2019 in Questions
I have a model that pulls data from two different child models (objects) and display records with a column called "Age". Age is a UI only formula field and it's the max of two child models. I couldn't find a way to sort the master model (parent table) based on this calculated UI only formula field. I tried few links which are a year or two old but no success. Any help is greatly appreciated.

Comments

  • Rob HatchRob Hatch 🛠️ 
    edited January 2019
    What version of Skuid are you running?  More current versions have allowed for client side sort (Millau and Spark). 

    On the table component you will have an option for "Sort Columns Client-side".   Once you turn this on - the "sort" option will appear in the field properties. 

    Also in the action framework you have a "sort" action that allows for client side sorting.  In this case you may have to edit the page XML to define the UI only field.  We have an improvement story pending to allow fields not "server side" sortable to be selected for client side sorting. 

    Hope this helps. 


  • edited January 2019
    Hi Rob,

    Thanks for your reply. We got the latest one (Millau (11.2.12)). I am looking to sort (ORDER by Age DESC) the records while displaying/rendering the table.
  • Rob HatchRob Hatch 🛠️ 
    edited January 2019
    So there are a number of ways you could do this... 

    After the model is loaded you will need to trigger an action sequence.  This can be done as a model action (in Model definition),  or as an action sequence triggered by the Skuid Page:Rendered event. (look for Action Sequences area below models and components). 

     image

    Then add an action to the sequence that sorts the model.  You will be able to define that it is client side sorting,  which field you want,  and how it should be sorted.  See image below where I am sorting on field "len"  

    image


    That should work for you.... 

  • edited December 2019
    Not sure if it's a version issue but I don't see what you see. Here is my view and I don't see an option to give UI only field in "Field" section.


  • edited January 2019
    It worked, thank you!
  • edited October 2019
    Hi Srikanth,

    To make the UI only field visible in the "Field" section, the "Sort Client Side" checkbox needs to be true. This is because the UI only field is available only on the client side.

    Hope this helps!
Sign In or Register to comment.