Flex DataGrid - How we get object of Custom Control from a cell -
There is a quick question about getting value from my control, which I added to my data grid via item render And how do I get it when I click on the cell in that column?
You can access it
& lt; Mx: DataGrid id = "fileGrid" click = "onclick" data provider = "{grpCollection}" width = "100%" height = "100%" & gt; & Lt; Mx: column & gt; & Lt; Mx: Data Grid column datafield = "label text" header text = "" visible = "{read only}" width = "100" & gt; & Lt; Mx: itemRenderer & gt; & Lt; Mx: component & gt; & Lt; Giver: LinkRendererWithEvent /> & Lt; / Mx: Component & gt; & Lt; / Mx: itemRenderer & gt; & Lt; / Mx: DataGridColumn & gt; & Lt; / Mx: column & gt; & Lt; / Mx: data grid & gt; Private Function onClick (Event: MouseEvent): Zero {if (event.target LinkRenderer is WitEvent) {var linkRenderer: LinkRendererWithEvent = event.target LinkRendererWithEvent; If (linkRenderer.linkBut.label == "add") {}}}
LinkRendererWithEvent.mxml
& lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; Mx: VBox xmlns: mx = "http://www.adobe.com/2006/mxml" width = "100%" height = "100%" DoubleClick enabled = "double-click" correct "=" doubleclick yogurt () "applies = "Mx.controls.listClasses.IDropInListItemRenderer" & gt; & Lt; Mx: script & gt; & Lt ;! [CDATA [import mx.controls.Button; Import mx.controls.DataGrid; Import mx.events.FlexEvent; Import com.barcap.customui.constant.NotificationNames; Import com.barcap.customui.ApplicationFacade; Import mx.controls.dataGridClasses.DataGridListData; Import flash.events.Event; Import mx.controls.listClasses.BaseListData; Import mx.controls.dataGridClasses.DataGridListData; Protected var_listData: DataGridListData; [BinDable] Public Spoken Label Field: String; Public Var Suggestive Name: String; Public function setFocus override (): zero {trace ("called"); } Private Function Clickhandler (Event: Mouse Event): Zero {Sending (incident); } Private Function DoubleclickYuder (): Zero {owner.dispatchEvent (new MouseEvent (MouseEvent.DOUBLE_CLICK, wrong, incorrect)); } Override public function set data (value: object): zero {super.data = value; SetIt (value); } Get public event listData (): Base ListData {return_listData; } Public Function Set List Data (Value: Base List Data): Nil {_listData = DataGridListData (Value); InvalidateProperties (); } Private Function Set (Value: Object): Zero {if (value & amp; _listData) {linkBut.label = value [_listData.dataField]; } And {linkBut.label = ""; }} Override Public Function Draphocus (isFocused: Boolean): Zero {trace ("insert focus"); }] & Gt; & Lt; / Mx: script & gt; & Lt; Mx: LinkButton id = "linkBut" textDecoration = "underline" click = "clickhandler (event)" /> & Lt; / Mx: VBox & gt;
Comments
Post a Comment