Dear Group,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.DataGrid;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.utils.ObjectUtil;
[Bindable]
public var myColl:ArrayCollection = new
ArrayCollection([{sno:1,sname:"Raja", grade:1},
{sno:2,sname:"Rama", grade:4},
{sno:3,sname:"Raghu", grade:2},
{sno:4,sname:"Rani", grade:3}]);
public function showText(item:Object, column:DataGridColumn):String{
if(item.grade==1)
return "One";
if(item.grade==2)
return "Two";
if(item.grade==3)
return "Three";
if(item.grade==4)
return "Four";
else
return "";
}
public function textSort(item1:Object, item2:Object):int{
//Alert.show(item1.grade+" -- "+item2.grade)
return ObjectUtil.stringCompare(showText(item1,null), showText(item2,null));

}
]]>
</mx:Script>
<mx:DataGrid x="192" y="138" dataProvider="{myColl}">
<mx:columns>
<mx:DataGridColumn headerText="SNO" dataField="sno"/>
<mx:DataGridColumn headerText="SNAME" dataField="sname"/>
<mx:DataGridColumn headerText="Grade" dataField="grade"
labelFunction="showText" sortCompareFunction="textSort"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
I found one solution as above snipet by googling but its giving a script
error!!! due to lot of values lot of iterations I think so.
Can any one suggest me? Please it is very urgent!!!
thanks,
Kotireddy.

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to