Support Topics Documentation Slack YouTube Blog

WhereClause Sorting

Hello,

I use the UI Builder and for a DataTable I use the whereClause in the PageData.
It is like:

TableID=‘Get Property of Value from AppData’

Now I want to sort the Data. How can I do this? I tried to add sortBy, but it failed:

TableID=‘Get Property of Value from AppData’ sortBy Name DESC

Hi Gerrit,

The codeless block you use to load data has the sort connector. You should use that to sort the data coming back from the server. The connector can have a text block with the name of the column to sort the data by.

Regards,
Mark

Hi Mark,

I am using the WhereClause Logic (Page Data Model) in the Handler-Area.

I have two DataTables. When the user clicks on an item of DataTable One, then the WhereClauseLogic of DataTable2 will be updated and filtered. It works very well, but now I want that the filtered Data will be sorted by a column.

Hello @Gerrit_Marttila

As Mark mentioned above you have to use a “Sort By” input connector for specifying sorting.
Could you please share the block you use?

Regards, Vlad

Bildschirmfoto 2021-06-02 um 15.14.26
Bildschirmfoto 2021-06-02 um 15.15.10

I made two screenshots. So you can see how I tried to solve it. In the third line of the block “create text with” should be added something like this: ’ sortBy COLUMNNAME DESC

thanks!

Seems like you use DataTable Component, don’t you?
And there is no way to change sorting option through the handler. This is a handler for whereClause and it can not contain any sorting parameters Search with the Where Clause - Backendless SDK for JavaScript API Documentation

but, the sorting can be changed in the running app

Yes but it would be nice, when the sorting is activated from the beginning. I think that I found a solution. In the Column-Configuration of the DataTable I can choose a default sorting of the column.