getting current table sort status

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

getting current table sort status

#1

Postby dvanhussel » Mon Oct 12, 2015 9:10 am

Hi,

Is there a way to get the current sort 'status' of a table?

I have a table with some columns set to 'sortable'. Users use this to find records they have to work on. When the table is updated, the table goes back to it's default sortation. So the user has to 'search' again for the record's it has to work on.

Of course I can restore the table sorting after the update with tables.tableName.sort(columns, directions) but to do be able to do this, I need to get the columns and directions the user selected.

Is there a way to get these?

Regards,

David
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Mon Oct 12, 2015 1:37 pm

David,

There isn't any way that you can query the sort status of a table from Javascript, but you shouldn't need to. The sort order should be maintained across an updatetable. Is this not happening?

Regards
Jon
0 x

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#3

Postby dvanhussel » Mon Oct 12, 2015 2:19 pm

Hi Jon,

Sorry, I made a mistake in my first post about this. On updateTable() the sorting is indeed preserved.

But, in order to get any new records that where added while the form is used, a fetchTable() command is issued. This resets the sorting. Is this supposed to work this way or not? (I'm using the second V5 beta)

The icon that shows the column order, after being changed by the user does not change after fetching the data. This seems to indicate that the tablerows are still sorted by that column, but they are not.

Regards,

David
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#4

Postby Jon » Mon Oct 12, 2015 3:34 pm

David,

Fetchtable resets everything including including any column sorts. It's a bug that the sort indicators aren't reset, I'll get this investigated. It's not quite clear to me why you need to re-issue a fetchtable - are you adding data to the table directly i.e. not using insertrow() on the table?

Regards
Jon
0 x

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#5

Postby dvanhussel » Mon Oct 12, 2015 3:47 pm

Jon,

This is for a system in which multiple users have access to records of their department. When the form is started, data is fetched from the database. The user searches for records to work on (newest, oldest, a specific category etcetera) by sorting the data in the table.

Then the user opens one of the records. After finishing working on this, the user goes back to the table (preferably sorted the way it was).

In the mean time data could have been added (by an other user or an integration resource in this project). I would like to update the table to contain these new records. These records are inserted with insertrow() but not in the formsession the user is in.

Is there a better way to do this?

Ofcourse, I could add some buttons to do the sorting in javascript, and then, after a fetchtable() reapply the sorting. But I would rather use the default Ebase functionality for this.

Regards,

David
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#6

Postby Jon » Tue Oct 13, 2015 7:49 am

There is no better way to do this at the moment. We will have a look at adding something to the table API, maybe getSortedColumns(), but this is not available at the moment.
0 x


Who is online

Users browsing this forum: No registered users and 8 guests