Wednesday, March 13, 2013

Flex Remove an Item from one Datagrid and push it into another Datagrid

To make this easier, we need to use Bindable ArrayCollections.

example:

[Bindable]
private var ac1:ArrayCollection;
[Bindable]

private var ac2:ArrayCollection;

private function init():void
{
        ac1 = new ArrayCollection(...);
        
        for( var s1:String in ac1)
            if( ac1[s1].id == 101)
            {
                ac2.addItem(ac1[s1]);
                ac1.removeItemAt( int(s1) );
            }

        dg1.dataProvider = ac1;
        dg2.dataProvider = ac2;
}

No comments:

Post a Comment