how to hide a row without deleting item from dataprovidor in DataGrid...AS3,Flex?
How we can hide a row at specific index of DataGrid 开发者_高级运维in AS3 ?
If dataProvider of your DataGrid
is ArrayCollection
you can specify filterFunction
property for it, something like that
dataProvider.filterFunction =
function (item:Object):Boolean{
if (dataProvider.getItemIndex(item)==indexOfRowYouWantToHide){
return false;
}
return true;
};
The item will still be in ArrayCollection but will be made invisible by the filter. Not the most efficient solution but it works. You need to call
dataProvider.refresh();
to apply the filter.
UPDATE: To access raw, unfiltered data of ArrayCollection
you should use list
property, so if you hid item at index 0 and still want to be able to access it you do that like this:
dataProvider.list.getItemAt(0);
No (easy) way. You can try to subclass DataGrid to add this functionality, but this will be really heavy task.
精彩评论