After a bit of digging I haven’t found a way to determine if Servoy is tracking the sort status. It would be nice to have Servoy know the sort state and what fields it was last sorted on and in which direction. I envision the following method to emulate the toggle sorting in most modern OS columns.
If this is doable today then please advise. It would seem wasteful to have to create a global to track this when this could be either a global or form specific property that can be checked aginst.
When we have a header on a tableview, we lose the nice feature of clicking on the header to sort. First click sorts ASC, second DESC.
To simulate this, I have a method to sort the records. I’m wondering if I can avoid using globals to store the last field clicked and whether it’s been clicked once or twice.
You can also use a header and have your own buttons and stuff - and not have to have an individual global for each sort state. You can, instead have a single global (MEDIA type) and store an array of the sort states of each field.
Then have a master routine to loop through the array (VERY fast!) and build your sort statement.
You can, instead have a single global (MEDIA type) and store an array of the sort states of each field.
I use this technique for almost everything that doesn’t have to survive a session. It is fast, requires only two methods (or even on), one to store a setting and one to retrieve and doesn’t produce traffic on the database. If you know what you are doing, you don’t even have to create that global as a dataprovider (since you never want to use it in a form). That was an excellent tip by Bob!
I use the Tooltip function of the header element to store the sort order and the user can now also get the information on which colomn and in what order his list is sorted, including text colors or sort symbols