• Chris Kettlewell
    March 6, 2018 at 2:23 pm #5024

    I have a coach view that contains a table.  The table is bound to a list variable that contains a list of accounts with some basic details to show in the table.  I am trying to get this sort sort into order, but the built in sort options don’t work.  The sort will change the order, but it basically changes the order to a different random order.

    If I set up the columns as sortable I can click on the headings over and over, and each time the order changes, but it just keeps changing to a different random order.  This is the same no matter which column heading I click on, all columns are output text attached to text fields in the list.  There is nothing complicated.

    I get the same result if I call the javascript .sort() option to sort by a specific column (which I do when first loading the screen, setting the default sort on one of the columns).  It will just put it into some random order, not sorted.

    I can’t see anything remotely strange or unusual.  It’s just a basic table linked to a basic list of text fields with the clickable sort option set to on.

    SPARK Support
    March 6, 2018 at 2:36 pm #5030

    Hi Chris,

    It appear that you have a Complex Type within the Business Object.  Please refer to the following Table article:


    In particular the Columns and Events sections:

    • Sortable When checked, data is sortable (Only simple type binding for columns is supported by default).  To sort a complex type you will need to use a custom Render, and an On New Cell event.
    • On Custom Cell When there is a new cell (In order for this event to work, the developer needs to create a custom render.  This can also be used to set cell.setSortValue(cell.value) for complex types)


    Stephen P.

    Chris Kettlewell
    March 6, 2018 at 2:45 pm #5033

    Hi Stephen,

    The types of the individual columns are all just string.  None of them are more complex than that.  The object linked to the table itself is a complex type, but I wouldn’t think it would be possible for it not to be (unless you had a single column table).  It’s a list of a complex type where all the fields within that complex type are just strings, and the individual columns are mapped to these strings.  So the columns aren’t complex types at all.

    Chris Kettlewell
    March 6, 2018 at 3:00 pm #5035

    I also tried putting “cell.setSortValue(cell.value)” into the “On Custom Cell” event for the table, but that didn’t do anything.  I’m guessing there’s more to it, but since there’s no more in depth information or examples or anything like that to be found anywhere, it makes it hard to work things like that out.

    Yoichi Yoshida
    June 24, 2020 at 5:06 pm #5778


    I have the exactly same issue. Is there any way to make table.sort() work?

    SPARK Support
    July 21, 2020 at 8:20 am #5793

    Hi Yoichi,

    If the cells are not simple data types, you will need to set the sort value of the cell in the On Custom Cell event.  You can return “V” from the event to have the regular Coach View rendered.

    In the event, access the value you wish to sort by cell.row.data.property, or create a sort value based on calculated values.  Then use cell.setSortValue(value) to set the sort order.


    Stephen P.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search