flash - How would I go about hideing a specified value from displaying in an array in a datagrid? -
for example, have:
public var usersonlinearray:array = new array(bob,jim,tim,marry,luke);
and when put datagrid this:
buddylist.dataprovider = new dataprovider(usersonlinearray); buddylist.rowcount = buddylist.length; bldbuddylist(buddylist);
how i, let's say, prevent luke appearing in datagrid? make him not appear technically "still there" can make him reappear later but?
i'd start using arraycollection rather array since can make use of data binding way.
arraycollection has filterfunction
property allow hide things still keep them in collection. docs expand on of gist is:
make arraycollection, takes plain ole array in constructor.
public var usersarr:array = [bob, jim, tim, marry, luke];
public var usersac:arraycollection = new arraycollection(usersarr);
set ac data provider list.
buddylist.dataprovider = usersac;
define filter function. function takes object , returns true if should visible, false if not.
public function myfilterfunction(o:object):boolean { if (o.tostring() == "luke") return false; return true; }
then apply function ac.
usersac.filterfunction = myfilterfunction;
to remove filter null our filterfunction property.
usersac.filterfunction = null;
Comments
Post a Comment