Ignition version 8.1.45
Problem
Clicking on the sort icon on the column header sorts the column, but it doesn't update the sort property for that column. Similarly, setting the sort property doesn't sort the column.
To reproduce
- Create new view
- Insert Table component
- Add three columns to Table.props.columns and set the field properties to city, country, and population to match the default table data respectively.
- Set the sort property of the city column to ascending.
- Table is not sorted.
Alternatively
- Create new view
- Insert Table component
- Add three columns to Table.props.columns and set the field properties to city, country, and population to match the default table data respectively.
- Enable preview mode.
- Click on the sort arrow next to the city column header.
- The sort property for the city column does not change.
From Perspective - Table | Ignition User Manual
sortOrder
The default weighted order in which columns and their contents are sorted relative to other columns and their contents. Used when the component loads.For sortOrder to be applied, the table must meet the following requirements:
- Objects under the columns array must be defined for each column in the table's underlying data property you wish to display and sort on.
- In addition, each object under columns must have the field setting set to the data item under the data property (for example, "population" in the table's default data set).
- sortable must be enabled.
- sort must be set to something other than none.
Once all columns have been configured, the sortOrder can be configured.Each element in the sortOrder array is expected to be a string value representing the name of the column (as determined by field value in the columns array). For example, sorting by population first, city second, and country last, would look like the following:[image]
It works on initial load at least. I'd have to play with it some more.
I'm beginning to think that all those properties, columns.x.sort
, and sortOrder
are only related to first load. If so they are read-only on load, don't change by user interaction with the table header and don't react to programming.
I wonder if there's a way to retrigger, like refreshBinding()
?
Make sure you have defined the "render" property from 'auto' to your column data type (string, I guess).
1 Like
The problem still persists with the column render property set
From @Transistor 's reply, are the names of your columns in thefield
props? Without that, nothing will work as the column config doesn't know what to work on
Forgive me, this is only my 30 something'th year speaking English, I still can't read 
2 Likes
Yes, he has specified that in the sample setup. I've replicated it.
2 Likes
Seconded.
They added a pager.activeOption
setting in 8.1.45 because pager.initialOption
didn’t work at runtime.
I pre-sort my data
My end goal is to pre-sort my data as well. However it would be nice to be able to use the table's sorting UI and sorting properties to provide input for the query. I had to make my own sorting component to do what I want, which is cumbersome and redundant.