Wednesday, November 5, 2008
Hi Guys , I recentally found a cool trick. the trick is How you will call external method from datagrid itemrender that do some action on your current datagrid.
I am posting a simple Example that is the Answer of this Question. By using this Code your can perform any action on datagrid from that own datagrid ItemRenderButton or Image.
Code is as Follows
mx:Script
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]private var myDP:ArrayCollection = new ArrayCollection([
{label1:"Order #2314", quant:3, Sent:true},
{label1:"Order #2315", quant:3, Sent:false} ]);
public function showRowID():void{
Alert.show("My selected row is"+myDG.selectedIndex.toString());
}
mx:Script
mx:DataGrid id="myDG" dataProvider="{myDP}" variableRowHeight="true"
mx:columns
mx:DataGridColumn dataField="label1" headerText="Order #"
mx:DataGridColumn dataField="quant" headerText="Qty"
mx:itemRenderer
mx:Component
mx:Button label="{'Click me'+data.quant}" click="{outerDocument.showRowID();}"
mx:Component
mx:itemRenderer
mx:DataGridColumn
mx:columns
mx:DataGrid
Labels: Datagrids
0 Comments:
Subscribe to:
Post Comments (Atom)