Datagrid sorting

Trevor DeVore lists at mangomultimedia.com
Mon Apr 26 12:01:23 EDT 2010


On Apr 21, 2010, at 12:10 PM, Marcello Bertoli wrote:

> I need to sort the lines of a datagrid with more than one criteria.
>
> For instance:
>
> The datagrid represents invoices with these columns:
>
> - invoice date
> - invoice number
> - invoice title
>
> When I click on the invoice date header I would like to sort the  
> lines of the invoice datagrid first by invoice date and then by  
> number.

Begin by reading this lesson:

http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7330-How-Do-I-Customize-Column-Sorting-

In the switch statement you create for "invoice date" just perform the  
sort you need using SortDataByKey (http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7334-How-Do-I-Sort-Records-By-A-Specific-Key-s-Values- 
):

on SortDataGridColumn pColumn
     switch pColumn
         case "invoice date"
             SortDataByKey "invoice date", ...
             SortDataByKey "invoice number", ...
             HiliteAndStoreSortByColumn pColumn
             break
         default
             pass SortDataGridColumn
     end switch
end SortDataGridColumn

Untested but it should work.

-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com



More information about the use-livecode mailing list