Table columns sorting

I have below questions on Table sorting:

  • If i have a table that need to be sorted by more than 1 column, is this possible? As i understand, only 1 column can be clicked for sortable Table.
  • If i have a Table sorted by a single column, new row is always added to the bottom of the list. Is this normal? I was expecting the row to be inserted in right sorted position.
  • I tried the @OrderBy to order the elements in the List collection attribute of the entity but the table edit action creates some strange result in the sorting of the Table rows. Row edited will sometimes get moved to the bottom of the list and it’s unpredictable.

Testing is done on the sample Sales app, Order and OrderLine entities with 1-To-Many composition.

I don’t understand fully the Table sorting behaviour and can’t find any detailed description. Hope someone can help provide explanation to my queries above. Thanks.

If i have a table that need to be sorted by more than 1 column, is this possible?

No, only one column can be clicked for sorting. We have plans for integrating the new Vaadin’s Grid component, it will allow us to do sorting by multiple columns.

If i have a Table sorted by a single column, new row is always added to the bottom of the list. Is this normal?

It’s normal in the current version (6.3), but we are going to change it: a new row will be inserted on top. It should be more clear for a user. Placing it in a “right position” requires reloading of the whole dataset, which is not good for performance, moreover, the new record can be outside of the current page, which can confuse the user. However, you can refresh the datasource always after inserting a record in a listener: see the action’s setAfterCommitHandler() method.

I tried the @OrderBy to order the elements in the List collection attribute of the entity but the table edit action creates some strange result in the sorting of the Table rows.

What platform version do you use? We’ve recently resolved an issue which could lead to a similar problem.

Thanks Konstantin for the answers. Look forward for the multi column sorting feature in future release.

For the 3rd issue, i just read CUBA platform release 6.2.8 that it include a fix for “Records move down in table linked to a NestedDatasource on opening an editor.”. It could be due to the same issue as i’m on platform 6.2.5 at the moment. I will upgrade and re-test.

Best regards,

David See

I just wanted to check the status on multiple column sorting now that DataGrid has been included in the platform.
I think it is not available now but would be a nice option - especially if it allows keeping multi-column ordering after datasource filter/refresh.

Thanks!