我想对我的 gridcolumn 进行排序。这是我的 sortCompareFunction 代码:
protected function sortCompareFunction(obj1:Object, obj2:Object, gc:GridColumn):int
{
collator.ignoreCase=true;
return collator.compare(obj1[gc.dataField], obj2[gc.dataField]);
}
和数据网格:
<s:DataGrid id="dataGrid" width="100%" height="100%" borderColor="#CCCCCC" borderVisible="true"
chromeColor="#CCCCCC" color="#000000" contentBackgroundColor="#8C90BB"
selectionColor="#D0E4E9" symbolColor="#FFFFFF" sortableColumns="true">
<s:columns>
<s:ArrayList>
<s:GridColumn width="150" dataField="title" headerText="Progetto"
sortCompareFunction="sortCompareFunction"></s:GridColumn>
<s:GridColumn dataField="author" headerText="Stato" width="50"></s:GridColumn>
<s:GridColumn dataField="newsdate" headerText="Scadenza"></s:GridColumn>
</s:ArrayList>
</s:columns>
<s:AsyncListView list="{FlexGlobals.topLevelApplication.PMProjs.lastResult}"/>
</s:DataGrid>
它不起作用。我在列标题中看不到箭头,并且任何内容都已排序。提前感谢您的帮助!
好的,通过用 Arraycollection 替换 AsyncListView 来解决:
<s:DataGrid id="dataGrid" width="100%" height="100%" borderColor="#CCCCCC" borderVisible="true"
chromeColor="#CCCCCC" color="#000000" contentBackgroundColor="#8C90BB"
selectionColor="#D0E4E9" symbolColor="#FFFFFF">
<s:columns>
<s:ArrayList>
<s:GridColumn width="150" dataField="title" headerText="Progetto"
showDataTips="title"></s:GridColumn>
<s:GridColumn dataField="author" headerText="Stato" width="50"></s:GridColumn>
<s:GridColumn dataField="newsdate" headerText="Scadenza"></s:GridColumn>
</s:ArrayList>
</s:columns>
<s:ArrayCollection list="{FlexGlobals.topLevelApplication.PMProjs.lastResult}"/>
没有 sortCompareFunction。