I'm quite newbies of flex, may I have some question to anyone who can suggest please.
I have grid for monitor CPU status and It look like this
CPU | CPU dif
--------------
5.9 | +0.2 ^
4.0 | -0.6 v
12.7| -1.5 v
The ^ , v in the picture above represent for [s:itemrenderer]
The problem is the column "CPU dif" cannot normally sort , so I use sortCompareFunction to solve this
public static function compareCPU(typeOne:Object, typeTwo:Object ,grid:Object):int
{
return ObjectUtil.numericCompare(Number(typeOne.cpu), Number(typeTwo.cpu) );
}
public static function compareCPUdif(typeOne:Object, typeTwo:Object ,grid:Object):int
{
return ObjectUtil.numericCompare(Number(typeOne.cpu_dif), Number(typeTwo.cpu_dif) );
}
AND
<s:GridColumn headerText="Cpu%" dataField="cpu" sortCompareFunction="compareCPU"/>
<s:GridColumn width="90" headerText="Cpu% Dif" sortCompareFunction="compareCPUdif">
<s:itemRenderer>
<fx:Component>
<s:GridItemRenderer width="100%" height="100%">
<s:HGroup width="100%" height="100%" verticalAlign="middle" horizontalAlign="left">
<s:HGroup width="50%" paddingLeft="5" horizontalAlign="left">
<s:Label text="{data.cpu_dif}"/>
</s:HGroup>
<s:HGroup width="50%" paddingRight="5" horizontalAlign="right">
<mx:Image source="{outerDocument.statusArrow.getItemAt(data.pic)as String}"/>
</s:HGroup>
</s:HGroup>
</s:GridItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
It looks strange that it's works for a half , they can sort correctly only one way (Ascending-sort)
When i have clicked it again, there is no responding.
Could you have any solution for this issue?
Highest thanks in advance