datagrid forms and pre-defined sorting sorting

Peter Haworth pete at
Wed Feb 2 20:22:37 EST 2011

There's a SortDataGridColumn message that is sent to the datagrid when the user clicks on a column to sort it.  I've not used it but I imaging you could grab the data ,sort it however you want it, then put it back into the datagrid within a handler for that message in the datagrid group script.  I think there's an example in the Datagrid manual.

Depending on the source of your data, you could sort it before loading it into the datagrid.  Most of the data in my datagrids comes form SQL databases so I sort it while selecting it from the db.

Pete Haworth

On Feb 2, 2011, at 5:05 PM, Monte Goulding wrote:

> Hi
> Let's say I have a datagrid with dgData keys [firstname] and [lastname] and I always want to show the list sorted in alphabetical order so I need to sort by firstname then by lastname. Is the only way to do that:
> set the dgData of group "datagrid" to mydata
> SortDataByKey "firstname", "international", "ascending", false
> SortDataByKey "lastname", "international", "ascending", false
> Wouldn't this refresh the data grid 3 times? It would be nice if there were a sort property of the datagrid so setting the dgData or changing the data in another way would automatically sort it before the first refresh. Or am I missing something Trev? 
> Cheers
> Monte
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list