Hi, I want to ask that the value of both a string and a radiobutton in a column is likely to be based on the value of < / P>
| Column1 | Column2 | R | Radiobutton | | S | String |
If column 1 has an R in column 1, then a radiobutan should be displayed, otherwise column 2 shows only one string.
Thank you for your reply
P> Sebastian
You have to type an item renderer to do so. However, whenever "Data" attribute is set, you want to update the status of the render. This is important because item presenters are recycled. Basically the data property is set, whenever the data of that renderer changes and as you scroll over the datagrid, it happens.
Here is a simple application with the DataGrid:
& lt; Mx: application xmlns: mx = "http://www.adobe.com/2006/mxml" layout = "absolute" creationComplete = "onCreationComplete ()" & gt; & Lt; Mx: script & gt; & Lt ;! [CDATA [Import mx.collections.ArrayCollection; [Bindable] Personal Variety Collection: Array Collection; Craze on private function (): Zero {collection = new ArrayCollection (); (Var i: uint = 0; i & lt; 20; i ++) for collection.addItem ({name: 'person #' + i}); }] & Gt; & Lt; / Mx: script & gt; & Lt; Mx: Data Grid Width = "600" Detector = "{Collection}" Line Count = "5" & gt; & Lt; Mx: column & gt; & Lt; Mx: DataGrid column item render = "com.foo.ItemRenderer" /> & Lt; / Mx: column & gt; & Lt; / Mx: data grid & gt; & Lt; / Mx: Applications & gt;
And a simple MXML-based renderer:
& lt; Mx: hbox xmlns: mx = "http://www.adobe.com/2006 / MXML" & gt; & Lt; Mx: script & gt; & Lt ;! [CDATA [Override public function set data (value: object): zero {super.data = value; // Show only radio buttons if the "name" of the data is "5" in the property; Otherwise show a label Radio S. Visible = RadiusindexInline = Radio M. Visible = RadioMincludeInlineout = Radiel Visible = Radiel.ind. Inline = data.Nameindexoff (5) & gt; -1; LabelName.visible = labelName.includeInLayout = data.name.indexOf (5) & lt; 0; }] & Gt; & Lt; / Mx: script & gt; & Lt; Mx: label id = "labelName" text = "{data.name}" /> & Lt; Mx: radio button id = "radioS" label = "small" groupname = "radio group" /> & Lt; Mx: radio button id = "radio" label = "medium" groupname = "radio group" /> & Lt; Mx: radio button id = "radio" label = "big" groupname = "radio group" /> & Lt; / Mx: hbox & gt;
Comments
Post a Comment