Sorting should happen every click, you should probably look into your sort
function....

Look at the attached code, it works fine:-

##DataGridSort.mxml###

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
backgroundColor="#FFFFFF">

<mx:Script>
<![CDATA[


function sortFunc(val1, val2)
{
val1 = Number(val1);
val2 = Number(val2);

if(val1 > val2) {
return -1;
}else if(val1 == val2) {
return 0;
}else {
return 1;
}
}


function getDGDP()
{
return [
{Artist:"Abdul", Album:"Classical Song",
Price:100.25},
{Artist:"Matt", Album:"Classical Song",
Price:200.25},
{Artist:"Manish", Album:"Rock", Price:300.33},
{Artist:"Sam", Album:"Rock Songs", Price:300.50} 

];
}



]]>

</mx:Script>

<mx:Panel title="DataGridColumn Sorting Example" marginTop="10">

<mx:VBox>

<mx:DataGrid id="myGrid" width="350" height="100"
creationComplete="event.target.dataProvider = getDGDP();">
<mx:columns>
<mx:Array>
<mx:DataGridColumn headerText="Artist"
columnName="Artist"></mx:DataGridColumn>
<mx:DataGridColumn headerText="Album"
columnName="Album"></mx:DataGridColumn>
<mx:DataGridColumn headerText="Price"
columnName="Price" sortCompareFunction="sortFunc"></mx:DataGridColumn>
</mx:Array>
</mx:columns>
</mx:DataGrid>

</mx:VBox>

</mx:Panel>


</mx:Application> 


Hope that helps..

-abdul


________________________________

From: Simon Fifield [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 11, 2005 6:03 AM
To: [EMAIL PROTECTED] Com
Subject: [flexcoders] DatagridColumn Sort function


I set up a DataGridColumn sort function but the sort only happens every
other header click even though the sort arrow changes direction on every
click.

Anyone got any ideas???


Kind Regards,

Simon Fifield


Yahoo! Groups Sponsor   
ADVERTISEMENT
click here
<http://us.ard.yahoo.com/SIG=12974qst1/M=298184.6018725.7038619.3001176/D=gr
oups/S=1705007207:HM/EXP=1110587583/A=2593423/R=0/SIG=11el9gslf/*http://www.
netflix.com/Default?mqso=60190075> 

<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
:HM/A=2593423/rand=253791226> 

________________________________

Yahoo! Groups Links


*       To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

*       To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 

*       Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 





Reply via email to