Page 1 of 1

Sort of a data grid under program control

Posted: Wed Aug 22, 2012 11:21 pm
by lohill
If I put the following command in the openCard event of a card:

dispatch "SortDataByKey" to group "DataGrid 1" with "Port Date", "datetime", "ascending"

When the card is finished opening, DataGrid 1 is sorted in ascending order of the column "Port Date"
However, if the last time the card had been open it had been sorted by the field "Value", the heading of the column "Value" would still appear as dark grey with the tick mark showing direction of sort for "Value" even though the actual sort was on "Port Date".

Is there a parameter that I am missing or another command that can be given to the header to make it reflect the sort that was done under program control?

Regards,
Larry

Re: Sort of a data grid under program control

Posted: Thu Aug 23, 2012 6:12 am
by bangkok
lohill wrote: Is there a parameter that I am missing or another command that can be given to the header to make it reflect the sort that was done under program control?
Yes. Add :

Code: Select all

  set the dgProp["sort by column"] of group "DataGrid 1"  to "Port Date"

Re: Sort of a data grid under program control

Posted: Thu Aug 23, 2012 11:45 pm
by lohill
Thanks bangkok!

Larry