Page 1 of 1

Sorting a datagrid

Posted: Tue Mar 01, 2011 3:20 am
by dsquance
I am trying to set up a button to sort the lines of a datagrid. The following is part of the script:

put orgchoice&"data" into thegroup ## orgchoice is a global variable, previously assigned
put orgchoice & " chq list" into thecard
put the dgtext of group thegroup of card thecard into dataset
sort lines of dataset numeric by word 1 of each
set the dgtext of group thegroup of card thecard to dataset

When I work with this in the message box, putting line 1 of dataset returns the correct line, but the datagrid is not being changed, ie the line I test is not the same as the line from dataset. Have I messed up the syntax somewhere?
Thanks, Dave

Re: Sorting a datagrid

Posted: Tue Mar 01, 2011 2:37 pm
by Janschenkel
Take a look at the examples I put together on my blog for one way of handling sorting in a datagrid: HTH,

Jan Schenkel.

Re: Sorting a datagrid

Posted: Tue Mar 01, 2011 10:56 pm
by dsquance
Thanks, Jan. I copied your script and pasted it into the datagrid script. However, clicking on a column header does not change the order of the lines, before or after refreshing. Perhaps there are some modifications I need to make, but am too much of an amateur to recognize. If nothing else, your comments before the script told me about sorting directly which worked for my datagrid. Of course, that's not available in the standalone.
Dave

Re: Sorting a datagrid

Posted: Tue Mar 01, 2011 11:02 pm
by dsquance
Looks like I posted too soon. It does appear to be working, however the heading for the first column has disappeared, and that's the column I want to sort by under non-testing conditions.
Dave