I'd say convert the XMLList to an ArrayList of objects as the best idea (XML isn't too fast), otherwise on result build an "index" arrayCollection of an ID column, and use a custom labelFunction to and sortFunction for that column that work on myIndex.getItemIndex(rowData.idField) or something like that. The second suggestion isn't going to be quick with big lists tho ;-)
-Josh On Thu, Jun 5, 2008 at 2:02 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > If you store it as a string, it will get sorted as a string, and XML is > all strings. If you convert XML to objects, you can get a numeric sort. > > > > You can probably fake the # by factoring rowIndex + verticalScrollPosition, > but then you can't sort on that since it is autogenerated, and any other > sort will change those numbers. > > > ------------------------------ > > *From:* [email protected] [mailto:[EMAIL PROTECTED] *On > Behalf Of *Indra Prastha > *Sent:* Wednesday, June 04, 2008 7:52 PM > *To:* [email protected] > *Subject:* [flexcoders] Datagrid default sorting and row number > > > > Hi guys, > > I need help about working with large data in a datagrid. > I have a datagrid that displays about 500 + rows which gets data from my > backend in XML (http service, resultFormat = e4x ). > Right now I want to display the row number for the data grid in the first > column "No.", without actually sending <no>row#</no> xml child in the data > that is sent from the backend, i tried using example from the documentation > using listData function, it works fine only for the displayed data, what i > mean is that, since there are 500 data and the datagrid only shows about 15 > first (the rest u have to scroll down) when you scroll down, the number > resets (means the 16th row shows the row number as 0 again). > > Found no other way to programmatically counts the row and display it in the > datagrid, i included <no>row#</no> in the XML being sent and works like just > i wanted .... UNTIL I click on the header and tried to sort it ascending / > descending. Now flex instead of sorting my data 1 to 500 or 500 to 1 , it > thinks that these numbers are string and sort them like a string -> > ascending sort will result in sort like this > 1,10,100,101,102...109...2,20,200,201 ..... and vice versa for descending. > > Any suggestions ? > Thanks again. > > Cheers! > > Indra Prastha, > [EMAIL PROTECTED] > ERP Team @ DataOn Corp. > > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

