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] <mailto:[EMAIL PROTECTED]> 
ERP Team @ DataOn Corp. 

 

Reply via email to