data grid, custom sorting

Trevor DeVore lists at mangomultimedia.com
Mon May 4 07:35:42 EDT 2009


On May 2, 2009, at 10:05 PM, Shao Sean wrote:

> When sorting a list of files by size I thought it would be nice to  
> display the sizes in more readable format (5.6 MB, 320 KB, etc) yet  
> doing a sort on the size column in the data grid would sort properly  
> for the numbers but would not be sorted correctly for the actual  
> sizes. Rooting around in the data grid parentScript I came across  
> "sortDataByKey" which allows you sort based on the actual data in  
> the dgData instead of what is displayed (1024 instead of 1 KB) -  
> that was the easy part.

While your custom sort will work one other approach would be to leave  
the data in your column in the original format so that numerical  
sorting still works. You could then format the data for display in the  
FillInData message.

> The hard part, which took all of four hours and one kernel panic  
> (which is my fourth one with the data grid), I managed to get the  
> column headers correctly hiliting (the documentation clearly point  
> this out as dgHilite so not too hard to figure out what command to  
> use). What the docs clearly miss though is that this is not a  
> property of the data grid (which would make it much easier to use  
> [feature request :) ]) but a property of the column header group so  
> you need to call it by its medium name (not a real feature of Rev).

I don't believe the docs state anywhere that dgHilite is a property of  
the data grid but says it is a property of a template. See here:

<http://revolution.screenstepslive.com/spaces/revolution_tools/manuals/datagrid/lessons/3462-Template-Custom-Properties 
 >

Row and column templates have the dgHilite property set so that you  
can visually change the look of the row and column.

Regards,

-- 
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Developer Resources: http://revolution.bluemangolearning.com




More information about the use-livecode mailing list