开发者

Binding two Flex array collection to Flex one array collection

In my flex application im using two datagrid

first datgrid is for items collections second is for bank details.

if i click one row in first datagrid (which has the items collections)...a unique code is taken from the grid(which is primary key).

then, i have to select two or more banks using itemrenderer checkboxes in second datagrid(which has the bank details)

now,,

i have to bind the 开发者_开发百科bank details(one or more banks) with that one primary key in first datagrid. to an single array collection... and have to show it in another new datagrid(thirdone)...

any suggestions.....? Thankx in Advance...


just try this example select 1 item from itemgrid then select multiple banks from bankgrid then click button.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" >
<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;
        [Bindable]private var arcitem:ArrayCollection=new ArrayCollection([{Itemid:"i1",itemname:"item1"},
            {Itemid:"i2",itemname:"item2"},{Itemid:"i3",itemname:"item3"}]);
        [Bindable]private var arcBank:ArrayCollection=new ArrayCollection([{Bankid:"b1",bankname:"Bank1"},
            {Bankid:"b2",bankname:"Bank2"},{Bankid:"b3",bankname:"Bank3"}]);
        [Bindable]private var arcFinalList:ArrayCollection=new ArrayCollection();
        private function something():void
        {

            for(var i:int=0;i<dgBank.selectedItems.length;i++){
                var obj:Object=new Object;
                obj.Itemid=dgItem.selectedItem.Itemid;
                obj.Bankid=dgBank.selectedItems[i].Bankid;
                obj.bankname=dgBank.selectedItems[i].bankname;
                arcFinalList.addItem(obj);} 
        }
    ]]>
</fx:Script>
    <mx:DataGrid dataProvider="{arcitem}" id="dgItem"  x="27" y="10" />
    <mx:DataGrid dataProvider="{arcBank}" id="dgBank"  x="322" y="10" allowMultipleSelection="true"/>
    <mx:DataGrid dataProvider="{arcFinalList}" x="641" y="9"/>
    <s:Button label="Click" click="something()" x="397" y="199"/>
</s:Application>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜