Datagrid sorting

Andre.Bisseret Andre.Bisseret at inria.fr
Thu Apr 22 12:49:28 EDT 2010


Le 22 avr. 10 à 11:38, Marcello Bertoli a écrit :

> Hi Andre,
>
> thank you very much for your answer. I tried your code but it  
> doesn't do the job. It is like pushing the column header of the  
> datagrid two times (first the number one and the the date one).

Bonjour Marcello,

Sorry, I had read your question too quickly. Did not noticed you would  
like to start from a click on the header (so went as if it would be  
from a button)
I am quite sure what you want is possible; (sure also that Trevor will  
help on that ;-))

Excited by the problem, I am trying to find a solution but up to now  
without any success. I don't find out how to get the name of the  
clicked column' header (except in the sort command itself)
the dgColumn of the target returns the name but not when clicking on  
the header (only when clicking on a a row in a column.

Looking forward getting a solution

Best regards from Grenoble

André
>
> My data come from a sql base so I can (as Steven said) make the  
> query do the work of the multiple sorting before loading into the  
> datagrid but I'm scared about performances when it comes to manage  
> hundreds of thousands of data. In this scenario I need to retrieve  
> data from the sql base and then populate the datagrid every time I  
> need to sort the rows without the data I already have in the  
> datagrid. This means more traffic over the network and multiple  
> populations of the datagrid...
>
> Best regards
> Marcello
>
>
>
> On 21/apr/2010, at 19.33, Andre.Bisseret wrote:
>
>> I think yes! Assuming for instance you want the dates sorted from  
>> the oldest down to the more recent
>> and then, for each date, the numbers should be sorted from the  
>> smaller down to the greater
>> you should sort the numbers column first then the dates' column.
>> Something like that:
>>
>> on mouseUp
>> ##setting the sort type value for each column
>>  set the dgColumnSortType["date"] of grp "datagrid 1" to "system  
>> dateTime"
>>  set the dgColumnSortType["number"] of grp "datagrid 1" to "numeric"
>>  set the dgColumnSortType["title"] of grp "datagrid 1" to text
>> ## making sure the two columns will have the same sortDirection if  
>> necessary
>>  set the dgColumnSortDirection["date"] of grp "datagrid 1" to  
>> "ascending"
>>  set the dgColumnSortDirection["number"] of grp "datagrid 1" to  
>> "ascending"
>> ## sort "number" first then "date"
>>  dispatch "sortByColumn" to grp "datagrid 1" with "number"
>>  dispatch "sortByColumn" to grp "datagrid 1" with "date"
>> end mouseUp
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution






More information about the use-livecode mailing list