CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Reverse order

by cyracks » 12 Oct 2016 21:54

Hi,

is it possible to manually set order by which navigator reads records in dataset. Currently it reads records according to position in dataset, but I would like to have reverse order.
For example if dataset holds values 1,2,3 (in that order) navigator works ok. But if dataset holds values 3,2,1 navigator doesn't work as expected, meaning that button next moves to prior record (if value is 3, click on next will move to 2)

I know custom events can be set for button clicks, so for example if button next is clicked code dataset.prior can be executed, but the problem is that buttons are automatically grayed when on the last/first position. So if in reverse order dataset position is on record 3 only "Last" button is active instead of "First".

Regards,
Tomaž
cyracks
 
Posts: 92
Joined: 09 Feb 2016 12:47

by ScottWGast » 13 Oct 2016 01:34

Have you tried sorting the dataset?
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by cyracks » 13 Oct 2016 09:23

That is the problem. From Dataset point of view order of rows is defined based on Dataset.IndexFieldNames or by "order by" directive in SQL statement, so bellow is the same:
Dataset.IndexFieldNames := "Field" Desc
or
Dataset.sql.text := 'select * from Table order by Field desc'

Navigator orders data based on dataset position and I do not see any option that order can be reversed from that in dataset. That means that rows in dataset must be set to ascending order for navigator to work "correctly" (meaning button next will move to higher value not lower).
cyracks
 
Posts: 92
Joined: 09 Feb 2016 12:47

by Jorge Sousa » 13 Oct 2016 12:22

Hi

The navigator uses the dataset as it is sorted, using TDataSet.First, TDataSet.Previous,TDataSet.Next and TDataSet.Last, etc...

You will never find a navigator that changes the order of the dataset
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQNavigator

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.