Datagrid with checkbox in its column

In my application I have a datagrid (a custom datagrid -
CheckBoxDatagrid), whose first colum contains checkbox as
itemrenderer. There is another column (Latest Version) - this
column can have two values either "Available" or "Update".
The requirement here is that, when the page is getting loaded
then depending on the value of the column "Latest Version" the
checkboxes will have to be loaded. If the value of the coluem is
"Available", then the checkbox corresponding to that row should get
automatically selected as soon as the page gets loaded.
I am attaching the code snippet below,
<configure:CheckBoxDataGrid id="swDataGrid"
initialize="swDataGrid.dataProvider=MaintenanceViewController.softwareList"
alternatingItemColors="[#ffffff, #ffffff]" paddingLeft="10"
paddingRight="5"
allowMultipleSelection="true" width="95%" height="60%"
paddingBottom="5" selectionColor="#1b77b7"
verticalGridLines="false"
creationComplete="{MaintenanceViewController.checkBoxSelect()};">
<configure:columns>
<mx:DataGridColumn id="checkBox" dataField="softwarename"
textAlign="center" headerText=" " width="20" sortable="false"
itemRenderer="com.pmc.view.tasks.wizard.CheckBoxRenderer"
editable="false">
</mx:DataGridColumn>
<mx:DataGridColumn id="swName" headerText="Software Name"
dataField="softwarename" width="130"/>
<mx:DataGridColumn id="cVersion" headerText="Current
Version" dataField="currentversion" width="80"/>
<mx:DataGridColumn id="updStatus" headerText="Update
Status" dataField="updateStatus" width="80"/>
</configure:columns>
</configure:CheckBoxDataGrid>
where, configure = defined namespace.

"BlueRHBA" <[email protected]> wrote in
message
news:go0hkf$2kt$[email protected]..
> In my application I have a datagrid (a custom datagrid -
> CheckBoxDatagrid),
> whose first colum contains checkbox as itemrenderer.
There is another
> column
> (Latest Version) - this column can have two values
either "Available" or
> "Update".
>
> The requirement here is that, when the page is getting
loaded then
> depending
> on the value of the column "Latest Version" the
checkboxes will have to be
> loaded. If the value of the coluem is "Available", then
the checkbox
> corresponding to that row should get automatically
selected as soon as the
> page
> gets loaded.
>
> I am attaching the code snippet below,
What is your question? Or are you looking to hire someone to
fulfill your
requirement?

Similar Messages

  • Flex 4 - Datagrid add checkbox to a column

    Hello all.
    I am trying to add a checkbox to a datagrid column, so that i can use it to delete a record from the array.  My datagrid is as follows
        <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
            <mx:columns>
                <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
                <mx:DataGridColumn headerText="Question" dataField="Question" />
                <mx:DataGridColumn headerText="Delete"  width="100" />
            </mx:columns>
        </mx:DataGrid>
    The user inputs questions into the array via a textinput box.
    But what i want to do is add a checkbox to the "Delete" column.  If anyone could help me with this that would be great !

    Ok, thanks both for your answers.
    I have now gone about doing it the following way:
        <mx:DataGrid x="10" y="40" width="903" dataProvider="{questionsArr}" sortableColumns="false" draggableColumns="false" editable="true">
            <mx:columns>
                <mx:DataGridColumn headerText="No." dataField="Number" width="100" editable="false"/>
                <mx:DataGridColumn headerText="Question" dataField="Question" />
                <mx:DataGridColumn headerText="Delete"  width="100">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:HBox horizontalAlign="center" verticalAlign="middle">
                                    <s:CheckBox/>
                                </mx:HBox>
                            </fx:Component>
                        </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>
    It works fine, as i add a question, a checkbox gets added to the Delete column.  Alls great.
    But when i come to click on the checkbox, the following text gets displayed [object Object]
    Then when i click away from the checkbox the checkbox reappears.  With it either selected or unselected depending on what value it should be.
    Is there anyway so that it dosent display the [object Object] ?

  • Datagrid with checkboxes

    I am new to flex and working on developing a  UI . I have a textinput to enter an id and a search button.once the search button is clicked after the user enters the data, it will make a http call which will fetch the results in xml format and then populate the data in a datagrid.
    once the data is populated, i have check boxes againt each row in the datagrid. Also I have two more buttons (say B1, B2) outside the datagrid but within the same panel.
    The above part is working fine. I am struck with the below requirement.
    Now my requirement is if  I select any one checkbox and click on either B1 or B2 button,
    1. I should be able to read the complete row details of the selected checbox
    2. Should be able to make a http service call and pass one of the column value ( from the selected row) as a request parameter
    3. Retrieve the result  in an xml format. now this result had to be populated in a seperate datagrid as part of popup window
    I am really struck on this and trying since a week , not able to proceed further.
    Any help on this is greatly appreciated.

    In the following code you will find an completely itemRenderer as CheckBox. I used because of serveral reasons:
    1. The checkbox should be in the middle of a table cell (use of VBox)
    2. Encapsulate this renderer for further DataGrids
    3. Data independency
    // Begin of Renderer
    <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                              xmlns:s="library://ns.adobe.com/flex/spark"
                              xmlns:mx="library://ns.adobe.com/flex/mx"
                              focusEnabled="true" horizontalCenter="0"
                              implements="mx.managers.IFocusManagerComponent">
        <fx:Script>
            <![CDATA[
                import mx.managers.IFocusManagerComponent;
                [Bindable]
                public var result:Boolean = false;
                [Bindable]
                private var _checked:Boolean = false;
                public function get checked():Boolean
                    return _checked;
                public function set checked(value:Boolean):void
                    _checked = value;
                override public function setFocus():void
                    checkBox.setFocus();
            ]]>
        </fx:Script>
        <mx:VBox horizontalAlign="center" horizontalCenter="0">
            <mx:CheckBox id="checkBox" selected="{_checked}" updateComplete="result=checkBox.selected" " />
        </mx:VBox>
    </s:MXDataGridItemRenderer>
    //End of Renderer
    Now you can use this renderer in a DataGrid, which you see in the following code:
    <mx:DataGridColumn ... dataField="property of the Object" rendererIsEditor="true" editorDataField="result" itemRenderer="path to the Renderer (app.renderer.CheckBoxRender for example)" />

  • DataGrid with dynamic comboboxes

    I need to design a dataGrid with comboboxes in one column. These comboboxes should all have different dataProviders based on a value from column 1. What would a general approach be?
    Thanks

    The renderer's data property is the data for the entire row so you can get the column1 data and assign the combobox's dataprovider accordingly.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Problem with checkbox item renderer in datagrid

    I have a data grid having check box as an item renderer. I have viewed many posts in this forum but nothing useful in my case. I am failed to bind my datagrid itemrenderer checkbox with the field of dataprovider i.e. listUnitMovement.CHECK_PATH. Then I have to traverse data provider to check which checkboxes are checked.
    [Bindable]
    var listUnitMovement:XMLList=null;                      
    In a function call
    public function init(event:ResultEvent):void
        listUnitMovement=event.result.unitmovement;
         <mx:DataGrid id="dg_country"
                               dataProvider="{listUnitMovement}"
                                  enabled="true">
                                <mx:columns>
                                   <mx:DataGridColumn>
                                        <mx:itemRenderer>
                                            <mx:Component>
                                                <mx:CheckBox selectedField="CHECK_PATH"  />
                                            </mx:Component>                                       
                                        </mx:itemRenderer>
                                    </mx:DataGridColumn>
                                    <mx:DataGridColumn headerText="Latitude" dataField="NEW_LAT" visible="false"/>
                                    <mx:DataGridColumn headerText="Longitude" dataField="NEW_LONG" visible="false"/>
                                   <mx:DataGridColumn>
                                        <mx:itemRenderer>
                                            <mx:Component>
                                                <mx:Button label="Details"/>
                                            </mx:Component>                                       
                                        </mx:itemRenderer>
                                    </mx:DataGridColumn>
                                </mx:columns>
                            </mx:DataGrid>

    Hi,
    Do you want to just check/uncheck the checkboxes based on the CHECK_PATH field.
    Do you want something like this...
    <?xml version="1.0" encoding="utf-8"?><mx:Application  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
     <mx:Script>
    <![CDATA[
     import mx.collections.ArrayCollection;[
    Bindable] 
    private var listUnitMovement:ArrayCollection = new ArrayCollection([{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:false,NEW_LAT:133.233,NEW_LONG:702.22}]);]]>
    </mx:Script>
     <mx:DataGrid dataProvider="{listUnitMovement}">
     <mx:columns>
     <mx:DataGridColumn>
     <mx:itemRenderer>
     <mx:Component>
     <mx:CheckBox selectedField="CHECK_PATH" change="data.CHECK_PATH=selected" />
     </mx:Component>  
    </mx:itemRenderer>
     </mx:DataGridColumn>
     <mx:DataGridColumn dataField="NEW_LAT"/>
     <mx:DataGridColumn dataField="NEW_LONG"/>
     </mx:columns>
     </mx:DataGrid>
    </mx:Application>
    Please let me know clearly what's your problem...Do you want to just bind the check box based on XmlList or something else..?
    Thanks,
    Bhasker Chari.S

  • Problem with Checkbox ItemRenderer in a DataGrid

    Hello Everyone,
    I'm using a datagrid with two columns, which is used as a data entry grid. The first column has a simple text input field and the 2nd column has a checkbox as an itemrenderer. On creationComplete event, I'm passing an arraycollection as the dataprovider for this datagrid. The arraycollection:
    <mx:ArrayCollection id="psAC">
            <mx:source>
                <mx:Array>
                    <mx:Object PaText="line1" PaCheckbox="0" />
                    <mx:Object PaText="line2" PaCheckbox="0" />
                    <mx:Object PaText="line3" PaCheckbox="1" />
                    <mx:Object PaText="line4" PaCheckbox="0" />
                    <mx:Object PaText="line5" PaCheckbox="0" />
                </mx:Array>
            </mx:source>
        </mx:ArrayCollection>
    There is a datagrid (dGa) in the main application. On click of this, a pop up window comes up which has the same datagrid layout(i.e, 2 columns). And this is where the data is entered. Here, if the user checks the check box, I have assigned a value of '1' for the 2nd column of the arraycollection. THis code(below) works fine.
    <datagrid in pop up window>
    <mx:DataGridColumn headerText="Best Possible Action?" textAlign="center" width="200" editable="false">
                                <mx:itemRenderer>
                                    <mx:Component>
                                       <mx:CheckBox>
                                            <mx:Script>
                                                    <![CDATA[
                                                         override public function set data(value:Object):void{
                                                             if(value.PaCheckbox == 1){
                                                                this.selected = true;
                                                            }else{
                                                                this.selected = false;
                                                    ]]>
                                                </mx:Script>
                                            <!--<mx:change>
                                                <![CDATA[
                                                    if(this.selected == true){
                                                         data.PaCheckbox = 1;
                                                     }else{
                                                         data.PaCheckbox = 0;
                                                ]]>
                                            </mx:change>-->
                                        </mx:CheckBox>
                                    </mx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn>
    But I would also need to set the PaCheckbox value to 0 or 1, based on teh check condition of the check box. I tried using change event (commented in the code above). But there I get an error: Cannot access a property or method of a null object reference. I checekd in debug mode, there the data object is null! Can you please help me on how to pass back the values(0 o 1) to my arraycollection, based on the checkbox's status?
    Cheers,
    Deepak

    heyo,
    I solved it.....
    i was missing this line of code super.data = value; in the ovverriden function...Once we have this line, the data object will have teh field names and their values in it, which can be accessed on the change event...

  • DataGrid with dynamic columns & renderers

    I'm developing using Flash Builder 4 & Flex SDK 4.1.
    I need to manage very dynamic DataGrid components and keep their definitions, which are all part of a complex item renderer of an Offers list.
    The objects structure is simplified as follows -
    Data: Model --> Offers ArrayCollection --> Offer VO --> DataGrid data ArrayCollection & DataGrid columns Array
    View: List --> Offer Item Renderer --> DataGrid
    1. Since the DataGrid's columns property accepts only an Array (not ArrayCollection), it seems like Data Binding for defining the columns is very problematic.
    I tried to bind it to the source property of an ArrayCollection that would keep my columns definitions, but it didn't really work (mainly header display bugs).
    What is the recommended way to keep the dynamic columns definition of a DataGrid?
    2. Each column can have a set of dynamic properties, so I created a "mutant" - Column VO that extends DataGridColumn and got a dynamic properties ArrayCollection on it.
    The columns got a custom header renderer that includes an icon when there are properties.
    The header renderers got 4 main states (NotSelectedWithProperties, SelectedWithProperties, NotSelectedWithoutProperties & SelectedWithoutProperties).
    However, the header renderer area seems a bit buggy when maintaning dynamic columns.
    Any thoughts on the subject?
    3. Anyway, I ended up recreating the DataGrid's columns Array very often (copying the columns definition on the offer's item renderer's dataChange event handler).
    Note that the dynamic properties can be edited when the column is selected and I copy their values from the view back to the model when entering the state NotSelectedWithProperties.
    This feels way too complicated and I really try to keep it simple, inspite of the required complexity.
    Does anyone have better ideas?
    4. In some cases the column's item renderer should also be modified into another DataGrid (grid-in-grid).
    I used the MXDataGridItemRenderer with a DataGrid and included an ArrayCollection for the "newValue" returned by the editor.
    (I use RendererIsEditor=true and on updateComplete populate that variable with the DataGrid's dataProvider contents)
    When needed, I loop though the data objects of the parent DataGrid and populate the related field with an ArrayCollection of key-value objects that are displayed on the internal DataGrid.
    After adding this feature I encounter very strange bugs -
    a. After editing the grid-in-grid values and changing the column's state (selecting & deselecting), I get the following exception:
    ArgumentError. Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/setChildIndex()
    at mx.core::UIComponent/setChildIndex().......6993....
    All I could find about this is that it might be related to some context error or something, but I'm really stuck on this one.
    b. Sometimes another column might copy value from one row to another, running over the previous value.
    I'm not sure exactly what sequence of actions causes this behavior, but it's related to that itemRenderer for sure.
    c. Switching places with a column that uses the grid item renderer (headerShift) causes a stak overflow of StyleManager that tried to get style from the DataGridItemRenderer. This one I just found out, but couldn't reproduce a second time... strange!
    I'm pretty sure this caused another problem that I don't remember at the moment.
    The bottom line is that there got to be a better way to implement this feature within this already-complicated environment.
    Maybe I'm doing something very wrong here...
    Please advice and thanks for reading all this.

    Update on item 4a -
    This was a major issue (the main reason for opening this thread really) and I managed to resolve it!
    As part of my application, I override the default DataGrid behavior for column selection (headerRelease event).
    Instead of sorting, I change the column's header looks and define it as Selected (for showing its dynamic properties and enable its deletion).
    At first I did this by setting styles, but the look didn't refresh unless I created a new instance of the header renderer.
    Later I changed thi behavior to work with states, but I left the new header renderer instance creation commands and those lines created all the mess!
    Conclusion -
    If you define a custom header renderer for your datagrid column and then a custom item renderer, don't create a new instance of your header renderer!
    It would still be nice to get some response for the other issues I raised.
    Thanks and have a nice week.

  • Problem with checkbox column in matrix

    Hello.
    I have a little problem with checkbox column in matrix.
    Column is binded to the UserData.
    It has ValOn="Y", ValOff="N".
    I use C++. It is wird problem. In matrix I have 10 columns - scrollbar role and if You want see checkbox column, You must role to the right. If this column is on the screen, and I use:
    checkcell->PutChecked(VARIANT_TRUE);
    then the checkbox is cheched, and if the checkbox isn`t on the screen and I use this comment - it nothing happening.
    I tried to use ValOn="Y", PutChecked...
    The problem i solved if the column is on the screen - if the column is first in matrix or second, but if it`s last I have a big problem.
    My column with checkbox is not editable, but I tried to make it editable, check it, and then make it uneditable - the same efect.
    How can I solve it ?
    Sorry for my english.
    Kamil Wydra

    Hello Kamil,
    I am not sure about your problem, but here is an example of how to use checkbox in UI API.
    First, create the matrix with checkbox column in Screen painter, and the output is an xml file, like this. Type as 121 indicates that it is a check box.
    - <column AffectsFormMode="0" backcolor="-1" description="" disp_desc="0" editable="0" right_just="0" title="Rented" type="121" uid="Rented" val_off="N" val_on="Y" visible="1" width="41">
      <databind alias="U_RENTED" databound="1" table="@VIDS" />
      <ExtendedObject />
    Second, bind the column to table from DB. This is a bug of 2004 Screen Painter, so if you are using 2005 Screen Painter, there is no problem.
    Third, when you open the form, you can check and uncheck the cell.
    BTW, please set the editable of the column to true.
    Hope this helps,
    Nick

  • Spark DataGrid with Dynamic Column Width

    Lets suppose I have a Spark Datagrid with no explicit typicalItem. When the Datagrid is initialized, the column widths are calcualted correctly based on the contents of the dataprovider. However if I add/remove an item from the dataprovider, or modify the one of the objects in the dataprovider, the column widths never update to reflect the change. Is the the correct behavior for a DataGrid? If so, is there any method I can call to force the DataGrid to recalculate and redraw the column widths?

    When Spark DataGrid doesn't have a typicalItem, it uses the first dataProvider item as the typicalItem.  If you change that, the DataGrid won't pick it up immediately. You can invalidate the current typicalItem using dataGrid.invalidateTypicalItem().

  • Dynamic DataGrid with Preferred columns

    Hi all,
    I want to populate a dynamic DataGrid with User Preferred
    columns (ex : EmpId,First Name and Phone). Each time columns may
    change based on User Selection in Preferences Page so columns
    should not hard code. I'm able to see data for EmpId, First Name
    but I want to see the Inner tag data of "Phone" as a Field.
    Sample XML ....
    <emp>
    <empId>1002</empId>
    <firstName>Smith</firstName>
    <lastName>John</lastName>
    <address>
    <city>Ohio>
    <phone>433-234-322</phone>
    <zip>60003</zip>
    </address>
    </emp>
    Thanks.

    To display nested data, you must use a labelFunction. I have
    several labelFunction examples on cflex.net.
    You can assign a function reference to the column's
    labelFunction property in the column generation code.
    Tracy

  • Selecting multiple rows using column header with checkbox in it.

    Dear All.,
    I am trying to select multiple rows with checkbox in column header but it doesnot works...
    Following is my codel
    <af:table value="#{bindings.xx.collectionModel}"
                          var="row"
                          rows="#{bindings.xx.rangeSize}"
                          emptyText="#{bindings.xx.viewable ? 'No data to display.' : 'Access Denied.'}"
                          fetchSize="#{bindings.xx.rangeSize}"
                          rowBandingInterval="1"
                          filterModel="#{bindings.xx.queryDescriptor}"
                          queryListener="#{bindings.xx.processQuery}"
                          varStatus="vs" partialTriggers="sbcSelectAll sbcChkFlag"
                          selectedRowKeys="#{bindings.xx.collectionModel.selectedRow}"
                          selectionListener="#{bindings.xx.collectionModel.makeCurrent}"
                          rowSelection="none" id="tCdMast" width="400"
                          columnStretching="column:c4" inlineStyle="height:200px;">
                  <af:column sortProperty="ChkFlag" filterable="true"
                             sortable="true"
                             headerText="#{bindings.xx.hints.ChkFlag.label}"
                             id="c2" width="55"
                             inlineStyle="#{row.ChkFlag ? 'background-color:#9CACC9;' : ''}">
                    <af:selectBooleanCheckbox simple="true" value="#{row.ChkFlag}"
                                              selected="#{row.ChkFlag}" id="sbcChkFlag"
                                              autoSubmit="true" immediate="true"/>
                    <f:facet name="header">
                      <af:selectBooleanCheckbox simple="true"
                                                autoSubmit="true"
                                                valueChangeListener="#{xxBean.onTableChkAllCheckChanged}"
                                                id="sbcSelectAll"/>
                    </f:facet>
                  </af:column>
    </af:table>
    Managed Bean
        public void onTableChkAllCheckChanged(ValueChangeEvent valueChangeEvent) {
            Boolean newValue =
                Boolean.valueOf(u.nvlString(valueChangeEvent.getNewValue(),
                                            "false"));
            Boolean oldValue =
                Boolean.valueOf(u.nvlString(valueChangeEvent.getOldValue(),
                                            "false"));
            if (newValue.equals(oldValue))
                return;
            int rowIndex=0;
            ViewObject vo = u.findIterator("xxIterator").getViewObject();
            vo.reset();
            while(vo.hasNext()){
              Row row;
              if(rowIndex==0)
                  row=vo.first();
              else
                  row=vo.next();
                 row.setAttribute("ChkFlag", newValue.booleanValue());
              rowIndex=1;
            u.addPartialTargets(tableDocuments);
        }Please help!!.
    Thanks & Regards,
    Santosh.
    jdeve 11.1.1.4.0

    Can you check this sample in the blog post?
    http://sameh-nassar.blogspot.com/2009/12/use-checkbox-for-selecting-multiple.html
    Thanks,
    Navaneeth

  • Reloading a datagrid with all its records

    Hi,
    Could someone please tell me how to reload all the records of
    a datagrid without having to reload the entire page. I'm using an
    XML file (e4x format) to populate a datagrid. Some rows of this
    datagrid get deleted during runtime and at some point I would like
    to be able to reload the datagrid with all its records. If you have
    some code and detailed explanation (I'm a newbie) that would be
    greatly appreciated. Thank you very much for your help.
    Olivia

    Hi Greg,
    The XML file is called like this: <mx:XML id="DataTbl2"
    format="e4x" source="DataTbl2.xml"/>
    And used in the Datagrid as follow:
    <mx:DataGrid id="impDG"
    rowCount="{getLengthOfXmlArray2(DataTbl1..Option.(Imchecked ==
    true))}" visible="true" dataProvider="{DataTbl2.Option}"
    editable="false" x="24" y="134" width="611">
    I tried impDG.dataProvider.refresh() and it doesn't work. I
    also tried DataTbl2.Option.refresh(); and I get an error during
    runtime: TypeError: Error #1006: value is not a function.
    What do you mean by "collection". I'm not using any array
    collection, just an xml file to populate the grid.
    Thank you for your help,
    Olivia

  • Problem with labelfunction with checkbox itemrenderer

    I have a DataGrid with a column that looks like this:
    <mx:DataGridColumn headerText="Buy online?"
    dataField="onlineshop" itemRenderer="mx.controls.CheckBox"
    rendererIsEditor="true" labelFunction="checkBoxLabel"
    editorDataField="selected" />
    My label function looks like this (for testing):
    private function checkBoxLabel(item:Object,
    column:Object):Boolean
    return false;
    The checkboxes in the grid always show up checked by default.
    What am I doing wrong?

    "endquote" <[email protected]> wrote in
    message
    news:e4e0cj$ffh$[email protected]..
    >I have a DataGrid with a column that looks like this:
    >
    > <mx:DataGridColumn headerText="Buy online?"
    dataField="onlineshop"
    > itemRenderer="mx.controls.CheckBox"
    rendererIsEditor="true"
    > labelFunction="checkBoxLabel" editorDataField="selected"
    />
    >
    > My label function looks like this (for testing):
    >
    > private function checkBoxLabel(item:Object,
    column:Object):Boolean
    > {
    > return false;
    > }
    >
    > The checkboxes in the grid always show up checked by
    default. What am I
    > doing
    > wrong?
    labelFunction is for the *label* (of the CheckBox, in this
    case). The
    selected property of the CheckBox is set based on the value
    of the
    dataField--in your case, "onlineshop". Is onlineshop true in
    all your items?
    Manish Jethani
    Developer, Flex Framework
    Adobe Systems Inc.

  • DataGrid with Custom Component not showing sub-components

    I'm hoping someone can enlighten me on this issue.
    I have a datagrid with one column which has an item renderer. It doesn't matter if the "text" data comes from a dataProvider or is static.
    If I do the following, only the first label will show up.
    <mx:DataGridColumn headerText="Column Title">
         <mx:itemRenderer>
               <mx:Component>
                   <mx:VBox>
                        <mx:Label text="{data.data1}" />
                        <mx:Label text="{data.data2}" />
                   </mx:VBox>
              </mx:Component>
         </mx:itemRenderer>
    </mx:DataGridColumn>
    However, if I change the VBox to a HBox both labels will show up.
    <mx:DataGridColumn headerText="Column Title">
          <mx:itemRenderer>
                <mx:Component>
                    <mx:HBox>
                        <mx:Label text="{data.data1}" />
                         <mx:Label text="{data.data2}" />
                    </mx:HBox>
               </mx:Component>
          </mx:itemRenderer>
    </mx:DataGridColumn>
    I'm using:
    Flex Builder 3 Standalone
    Version: 3.0.214193
    OS: Vista
    Any ideas or comments would be appreciated.

    Thanks for the reply KomputerMan.com. I've tried changing the dimensions of the VBox and no other labels appeared. Usually, when there is not enough room within the datagrid cell scrollbars will appear - you can experiment with the example below to see what I mean.
    As for radiobuttons in a datagrid, here you go. The DataGrid and its dataProvider are constructed in the same way you normally would.
    <mx:DataGridColumn headerText="Approve/Deny/Pending" width="170">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox height="27" paddingLeft="10">
                    <mx:Script>
                        <![CDATA[
                            private function isSelected(s:Object, val:String):Boolean {
                                if ( s.toString() == val) {
                                    return true;
                                } else {
                                    return false;
                        ]]>
                    </mx:Script>
                    <mx:RadioButton groupName="approveType"
                        id="approved"
                        label="A"
                        width="33"
                        click="data.status='1'"
                        selected="{isSelected(data.status, '1')}"/>
                    <mx:RadioButton groupName="approveType"
                        id="denied"
                        label="D"
                        width="33"
                        click="data.status='2'"
                        selected="{isSelected(data.status, '2')}/>
                    <mx:RadioButton groupName="approveType"
                        id="Pending"
                        label="P"
                        width="33"
                        click="data.status='3'"
                        selected="{isSelected(data.status, '3')}/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

  • Datagrid itemRenderer checkbox

    Hi,
    I have datagrid control in my application and I use itemRenderer to render some data received from webservice. Works just fine but I would like to disable changing state of checkbox. I am using checkbox renderer just to show data more user friendly and not that users can check and uncheck it. So how can I disable checking and unchecking (by user click interaction) my checkbox in datagrid?
    I my example column with dataField "IsAlive" is the one rendered by CheckBox component.
    <mx:DataGrid id="lstAllPushes" left="10" right="10" top="10" bottom="60">
    <mx:columns>
    <mx:DataGridColumn headerText="ID" dataField="ID"/>
    <mx:DataGridColumn headerText="Start date" dataField="DateInserted"/>
    <mx:DataGridColumn headerText="Expiration date" dataField="DateExpiration"/>
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" itemRenderer="mx.controls.CheckBox"/>
    </mx:columns>
    </mx:DataGrid>
    Thx in advance.

    Try this:
    <mx:DataGridColumn headerText="Alive" dataField="IsAlive" >
         <mx:itemRenderer>
              <mx:Component>
                   <mx:CheckBox enabled="false"/>
              </mx:Component>
         </mx:itemRenderer>
    </mx:DataGridColumn>

Maybe you are looking for