I was extending a standard dual browser screen. I noticed that when you edit an element in a table that has sorting applied, and you change the field’s value that affects the ordering and save the edited item, the browse table does not refresh its order.
This is the first problem, as I think that the table should listen for such changes and maintain the sorting state consistent.
But in this case I thought I could do that myself, and tried to get the current sorting applied, and reapply the sort only if the table was actually sorted and the field’s value changed. I wanted to do this to avoid an entire datasource refresh (but mainly for learning).
At this point I noticed that the Table interface doesn’t provide any method to get the current sorting state (neither if the table is sorted, nor the field(s) on which the sorting is applied).
I think this shouldn’t be hidden away, as this data is readily available to concrete components, in every technology (web, desktop and whatever).
Am I missing something? In case that methods are really missing, I’d like them added to the abstract Table component…
For now I suspect the only way to reapply the correct sorting is to refresh the table’s datasource (simple, but not so elegant).
According to a chat in Gitter, this is not currently possible… I add my vote to add declarative sorting to Table components (including DataGrid).
Quoting from Gitter:
> Unfortunately, sorting in table is an imperative action and can’t be defined declaratively, that’s why you cannot get the sorting state now. But as I know this question is in discussion
You are right that this feature should be available for Table. I’ve created an issue in our bug tracker https://youtrack.cuba-platform.com/issue/PL-9171 We will add this feature in the next minor release of the platform.
I’m not sure about sorting consistency by default since it requires additional database queries. We should discuss it in our team.