How we can hide a row at specific index of DataGrid in AS3 ?
views:
32answers:
2
A:
No (easy) way. You can try to subclass DataGrid to add this functionality, but this will be really heavy task.
alxx
2010-10-08 11:07:54
Looks like @2DH has an easy way!
Amarghosh
2010-10-08 11:15:35
+5
A:
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);
2DH
2010-10-08 11:11:29
+1. The filtering API is built into the ListCollectionView class. Any class extending that will offer the same filtering functionality. XMLListcollection is another option in the Flex Framework. I know there are other implementations out there in the community, such as the DataCollection from Farata Systems folk.
www.Flextras.com
2010-10-08 12:54:58
i used this to hide row at 0 index but when i get the item from dataprovidor at index 0.. item is removed from dataprovidor .. i want value should be in dataprovidor but just dont appear.
Muhammad Husnain Ashfaq
2010-10-11 07:13:20