Hey guys, Right, I’ve a situation
where I need to sort a particular datagrid column as
a date, however the value of the cell is actually a string (eg
I’ve got this all
working, however I’m trying to package it up as a class so I can reuse it
100 times through the various datagrids I’ve
got. My problem is I’m calling: dg.dataProvider.sortItems(dateFieldCompare, ((sortOrder
== 1)? 0: Array.DESCENDING)); Where dg is my datagrid (passed through via the class constructor). The issue I’m having is that I
cannot access any variables from the dateFieldCompare
function. My constructor header is as follows: public function DateSortUtil(myDg:mx.controls.DataGrid,columnIndex:Number,field:String)
{ Ideally I want field to be
accessible to the dateFieldCompare function so I know
what field to compare. The following is the header from dateFieldCompare: private function dateFieldCompare(item1:Object,
item2:Object, bit:Number):Number To get it working at the
moment I’m having to compare item1.date and item2.date
. However ‘date’ won’t always be the name of the
fields I want to compare, and item1[field] isn’t
going to work. Any ideas? Cheers, Steve -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com YAHOO! GROUPS LINKS
|
- [flexcoders] Custom Datagrid Sorting Steve Cox
- RE: [flexcoders] Custom Datagrid Sorting Abdul Qabiz
- RE: [flexcoders] Custom Datagrid Sorting Steve Cox
- RE: [flexcoders] Custom Datagrid Sorting Steve Cox