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...

Similar Messages

  • 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 combobox

    I am rendering checkbox in combox(dynamically). when i check
    any item(s) in my combox and then on selecting(checking the
    combobox's item) another item(s) or on scrolling item list in
    combobox, it shows improper checkd items. i .e the checkd list
    displayed is totally different, with randomnly checkd items in that
    list.
    please help me out?

    hi,
    i think you have to try itemEditor instead of
    itemRenderer

  • Problem with checkbox group in row popin of table.

    In table row popin I have kept Check Box Group.I have mapped  the texts property of checkbox group to the attribute which is under the subnode of the table.the subnode properties singleton=false,selectioncardinality=0-n,and cardinality=0-n.
    if there are 'n' number of records in the table.each record will have its own row popin and in the row popin there is check box group.
    the check box group in the row popin  belongs to that perticular row.
    but the checkboxegroup values in row popins of all the  rows are getting changed to the row which is lead selected.
    The same scenario  (table in the row popin is showing the values corresponding to its perticular row and all the table values in popin are not getting changed to the one lead selected in the main table)is working fine with the table in place of  checkbox group in row popin with datasource property of table  binded to the subnode
    I cant trace out the problem with checkbox group in place of table.
    Please help me in this regard.I have to place check box group in place of table in row popin.
    Thanks and Regards
        Kiran Kumar K

    I have done the same thing successfully with normal check box ui element. Try using check box in your tabel cell editor instead of check box group.

  • 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

  • Problem with checkbox on table component

    Hello i am having a problem with checkbox in table component
    i am developing something like a shopping cart app and i have a checkbox in my table component , i want users to select items from the checkbox to add to thier cart, They can select the items from cartegory combobox , my problem is when they select the items from the checkbox if they select another category the alread selected once do not display in my collection opbject please how can i maintain the state of the already selected items in my collection object

    Hi,
    Please go through the tutorial "Understanding scope and managed beans". This is available at:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/scopes.html
    The details of the selected items need to be stored in an object that is in session scope.
    Hope this helps
    Cheers
    Girish

  • Problem with checkbox value and app.settings.getSetting()

    Hello everyone.
    I`ve got a problem with getting saved settings for checkbox.
    Saved settings doesn`t apply on checkbox value.
    It`s strange, but it always "true".
    So here piece of code:
    checkMe = 11;    //any value for the first time running
    if (app.settings.haveSetting("savea", "chck")) {                           
                          checkMe = app.settings.getSetting("savea", "chck");  // get saved value, else 11
                          alert("checkMe = "+checkMe)
                        if(checkMe == 11){
                            checkMe= false;   //if there is no saved settings, checkbox value will be false/ unchecked
                            alert("You run this script first time, so manual value will be 'false'")
                            }else{
                                checkMe = app.settings.getSetting("savea", "chck");     // if saved settings exist, get true or false
         alert("Yes, checkMe will = "+checkMe)       
    win.checkPanel.chkOne.value = checkMe;  /// checkbox value will equal saved checkMe
    var fff = win.checkPanel.chkOne.value;  // string for alert
    alert("aha! but checkbox value is  = " +fff+ "\n Why so?")     // here we`ve got always "true"
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;  //  checkbox value to variable
        app.settings.saveSetting("savea", "chck", path11);  //saving checkbox value
        alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
    win.checkPanel.chkOne.value is always true.
    Can someone exmplain why and how to get rid of this static value?
    P.S. just in case, here is full code:
    function mainFun()
        this.windowRef = null;
    mainFun.prototype.run = function()
        /*----- UI -----*/
              var retval = true;
              var win = new Window("palette", "Check option", [150, 150, 460, 455]);
              this.windowRef = win;
              win.checkPanel = win.add("panel", [25, 150, 285, 265], "Checkbox");
              win.checkPanel.chkOne = win.checkPanel.add("checkbox", [10, 15, 125, 35], "Checkbox One");
              //win.checkPanel.chkTxtOne = win.checkPanel.add('edittext', [140, 15, 230, 35], '');
         win.quitBtn = win.add("button", [110,275,200,295], "Close");
    checkMe = 11;    //any value for the first time running
    if (app.settings.haveSetting("savea", "chck")) {                           
                          checkMe = app.settings.getSetting("savea", "chck");  // get saved value, else 11
                          alert("checkMe = "+checkMe)
                        if(checkMe == 11){
                            checkMe= false;   //if there is no saved settings, checkbox value will be false/ unchecked
                            alert("You run this script first time, so manual value will be 'false'")
                            }else{
                                checkMe = app.settings.getSetting("savea", "chck");     // if saved settings exist, get true or false
         alert("Yes, checkMe will = "+checkMe)       
    win.checkPanel.chkOne.value = checkMe;  /// checkbox value will equal saved checkMe
    var fff = win.checkPanel.chkOne.value;  // string for alert
    alert("aha! but checkbox value is  = " +fff+ "\n Why so?")     // here we`ve got always "true"
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;  //  checkbox value to variable
        app.settings.saveSetting("savea", "chck", path11);  //saving checkbox value
        alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
              win.quitBtn.onClick = function() {
                  win.close();
        win.center();
              win.show();
              return retval;
    if(typeof(mainFun_unitTest) == "undefined") {
        new mainFun().run();

    Played around with different values, combinations...
    Doesn`t work too:
    checkMe = 111;    //any value for the first time running
    if (app.settings.haveSetting("333", "check")) {                           
                          checkMe = app.settings.getSetting("333", "check");
    alert(checkMe);
                    if(checkMe == 111){
                             win.checkPanel.chkOne.value= false;
                            }else{
                                if (checkMe != false){
                                win.checkPanel.chkOne.value= true;
                                }else{
                                win.checkPanel.chkOne.value= false;
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;
        var path12 = path11.toString();
        app.settings.saveSetting("333", "check", path12);
        alert("Saved value - " + app.settings.getSetting("333", "check"))

  • Problem with checkbox in the selection screen

    Hi guys,
    I have a problem with the check box in the selection screen.When i select a check box then a field in the selection screen should be enabled for entering a value.Again if i unselect the checkbox then the field should be disabled for entering a value.I have written the code in at selection-screen output.
    The problem is when i select the check box ,the field is not enabled.But when i press enter after selecting the checkbox then the field is enabled for input.It is the same when i unselect the checkbox,after i press enter only the field is getting disabled.What could be the problem.Any suggestions please?
    Thanks.

    Hi d p
                 Please try this code . I think this code have some way that you would like.
    REPORT  zdownload_to_application_server.
    TABLES : caufvd, jest.
    I N C L U D E  P R O G R A M                                        *
    *INCLUDE znrpstnd.
    Selection Screen                                                    *
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.
    PARAMETERS: p_outb RADIOBUTTON GROUP g1 USER-COMMAND outb DEFAULT 'X' ,
                p_inb RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    PARAMETERS : p_werks LIKE caufvd-werks MODIF ID a.        " Plant   "OBLIGATORY
    SELECT-OPTIONS  :  s_auart FOR caufvd-auart MODIF ID a,       " Order Type
                       s_aufnr FOR caufvd-aufnr MODIF ID a.       " Order number
    PARAMETERS: p_path TYPE string DEFAULT 'C:\SchedulerInterface-OutboundTextFile\' MODIF ID a,
                p_actual AS CHECKBOX MODIF ID a.                  " Transfer Actual
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETERS : p_werks2 LIKE caufvd-werks MODIF ID b,   " Plant   "OBLIGATORY
                 p_path2 TYPE string DEFAULT 'C:\SchedulerInterface-InboundTextFile\' MODIF ID b,
                 p_path3 TYPE string DEFAULT 'C:\SchedulerInterface-InboundTextFile\' MODIF ID b,
                 p_sessio TYPE apqi-groupid MODIF ID b.   " BDC Session
    SELECTION-SCREEN END OF BLOCK b2.
    AT SELECTION-SCREEN OUTPUT.
      IF p_outb EQ 'X'.   " Outbound --> Hide inbound
        LOOP AT SCREEN.
          "IF screen-name = '%BT02011_BLOCK_1000'.
          IF screen-group2 = 'BLK'.
            screen-active = 1.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'A'.
            screen-active = 1.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'B'.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          "IF screen-name = '%BT01004_BLOCK_1000'.
          IF screen-group3 = 'BLK'.
            screen-active = 1.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'A'.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'B'.
            screen-active = 1.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path2.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = 'C:\SchedulerInterface-InboundTextFile\'
          mask             = ',Text Files,.txt,All files,.*.'
        IMPORTING
          filename         = p_path2
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path3.
      CALL FUNCTION 'WS_FILENAME_GET'
        EXPORTING
          def_path         = 'C:\SchedulerInterface-InboundTextFile\'
          mask             = ',Text Files,.txt,All files,.*.'
        IMPORTING
          filename         = p_path3
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
    TOP-OF-PAGE.
    START-OF-SELECTION.
    Regards
    Wiboon

  • Problem with checkbox selection in Tableview

    Hi All
    I am using table view with 8 columns - in the last 4 columns i have checkboxes for user input - i have a strange problem - when the table has multiple entries - for the last column i can only select the checkbox on line 1 - and i cannot select the checkbox on the remaining entries below - but for the other colums with checkboxes this is not the case
    The selection mode for the table is no line selection - since the table is already displayed with input enabled fields - this is to reduce the no of clicks for user
    Can anyone point out what is going wrong - how can i fix this - what i am doing wrong ?
    Thanks
    Sen

    Hi
    When i click on the checkbox for the 2nd or 3rd rows of the last column - nothing happens - the checkox is still active but nothing happens -
    this is the tableview code
    <htmlb:tableView id              = "Detail"
                     design          = "ALTERNATING"
                     headerText      = "Header Text"
                     onNavigate      = "onMyNavigate"
                     emptyTableText  = "test"
                     onRowSelection  = "onMyRowSelection"
                     fillUpEmptyRows = "false"
                     footerVisible   = "true"
                     visibleRowCount = "5"
                     table           = "<%= DETAILTAB %>"
                     iterator        = "<%= iterator %>" >
    and this is the code for the last column
    <htmlb:tableViewColumn columnName         = "OBSOFLGICON"
                               width               = "3"
                               type                = "user"
                               horizontalAlignment = "CENTER"
                               title               = "Obs" >
          <htmlb:checkbox />
        </htmlb:tableViewColumn>
    Thanks
    Sen

  • Problem with checkbox and Event.stop(event)

    Hello,
    I cannot change the checkbox in a row, if the Event.stop(event) is fired on checkbox. My aim is, that the event OnRowClick is stoped, if I change the checkbox in the row.
    <rich:extendedDataTable id="requestTable" value="#{requestListHandler.normalisedRawRequestList}" var="req"
                             rows="#{requestListHandler.limitRows}" selectionMode="single">
                             <a4j:support event="onRowClick" action="#{requestListHandler.viewRequest}">
                                  <f:setPropertyActionListener value="#{req}"
                                       target="#{requestHandler.selectedRequest}" />
                                  </a4j:support>
                            <rich:column>
                                       <h:outputText value="#{req.offerListSize}">
                                            <f:convertNumber type="number" />
                                       </h:outputText>
                         </rich:column>
                             <rich:column id="checkBoxColumns">
                                       <h:selectBooleanCheckbox onclick="Event.stop(event);"
                                            value="#{req.firstInterpreterTimeChecked}"/>
                         </rich:column>
    </rich:extendedDataTable>I know I am using richfaces, but I have problem with sun-ri component <h:selectBooleanCheckbox..../>.
    Have you any idea?
    Manu
    Edited by: Argonist on Jun 16, 2009 8:27 AM
    Edited by: Argonist on Jun 16, 2009 12:25 PM

    I had the same problem. I read you post and was so disappointed that no one had answered you. But I have a good news for you :) My team leader managed to solve this awkward problem.Add to h:selectBooleanCheckbox style="z-index: 20;" so that it is "above" the table row that fires its own onclick event.

  • Problem with Checkbox that disables/enables other components.

    Hi
    As I show in the title, I have problems with a checkbox that enables/disables another components (three exactly).
    I have done the follow:
    1.- Set property "AutoSubmit" true in the SelectOneChoice
    2.- Set "Disabled" property true or false depending if the SelectOneChoice is selected or not
    (#...selectBooleanCheckbox.value?false:true})
    3.- Set the Partial triggers to the SelectOneChoice in the three components.
    CASE 1: The SelectOneChoice is unmarked. The three components appears disabled and when I mark the SelectOneChoice, this components appears enabled. The thing works ;)
    CASE 2: The SelectOneChoice is marked. The three components appears enabled and when I unmark the SelectOneChoice, the components continue enabled. They don't disable until I press the submit button.
    how can i make that the components appears disabled when i unmark the checkbox?
    i try with de ChangeValueListener, but it only works where the SelectOneChoice changes from unmarked to marked.
    thanks!

    I think the problem is, when the value is null the checkbox return with the selected state, b'coz u r
    returning the checkbox (as it is). so pl'z try with below code (ADDED).
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column){
    if(value != null){
    Boolean booleanValue = (Boolean)value;
    setSelected(booleanValue.booleanValue());
    else /// ADDED
    setSelected(false);/// ADDED
    return this;
    Nediaph.

  • Problem with checkbox and process

    Hallo,
    I have a checkbox on my page and now I want to create a process that runs when the checkbox is checked.
    What I want to do is: to ckeck wheather the checkbox is check and if this is then to set values.
    I don't know if it is right how I check the status of the checkbox. What I also don't really know how I can decide
    that all field I go through in the loop get the same value from the XYZ-collection. The value should be the last from
    the XYZ-collection.
    Thanks, Jade
    declare
    check integer:=0;
    change integer:=0;
    begin
    check:=:Px_Check;
    if (check <> 0) then change:=1; end if;
    if change = 1 then
    for i in 1..htmldb_application.g_f04.count
    loop
    htmldb_collection.update_member_attribute(p_collection_name=>'XYZ',
    p_seq=>i,
    p_attr_number=>5,
    p_attr_value=>???);
    end loop;
    end if;
    end;

    Hi,
    Taking the two issues separately....
    1 - When dealing with checkboxes, you have to bear in mind that the submit process will only return the values of those checkboxes that have been ticked into the f04 collection (assuming f04 is the column containing your checkboxes). In order to determine which ones they are, you need to get the value (which should be a row number if you've created the checkboxes by using the Row Selector option) and then use that to get to the values on the actual rows. Something like:
    DECLARE
    vITEM NUMBER;
    BEGIN
    FOR i IN 1..HTMLDB_APPLICATION.G_F04.COUNT
    LOOP
      vITEM := HTMLDB_APPLICATION.G_F04(i);
    END LOOP;
    END;Then, within the loop, you can use vITEM as the row number. So, if the user ticked items 1, 4 and 6. G_F04(1) would contain 1, G_F04(2) would contain 4 and G_F04(3) would contain 6. Therefore, for you update statement, you can use vITEM for the sequence number of the item to update.
    2 - When dealing with collections, if you want to get to the last item in the collection, you can get the member count and use that to get to the member:
    DECLARE
    vCOUNT NUMBER;
    vDATA NUMBER;
    BEGIN
    vCOUNT := HTMLDB_COLLECTION.COLLECTION_MEMBER_COUNT ('XYZ');
    SELECT c005 INTO vDATA FROM HTMLDB_COLLECTIONS WHERE COLLECTION_NAME = 'XYZ';
    END;That should get the c005 value for the last item and store it in vDATA. You can then update the ticked items with this value.
    Andy

  • 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.

  • Problem with checkbox and run the get button event continuously

    Hi all,
    I have a checkbox list of 3 sensors. I have used the X-Control (for checkbox) found in the following link for my application https://decibel.ni.com/content/docs/DOC-30558. I have problems to achieve the following.
    Suppose i check Vibration and Strain, I should be able to display both Vibration and Strain data. (I should compare each element of 1d array with the string constant and run the case structure).
    I have to run the GET event continuously to display the data. 
    I have attached the code to the post.
    Please can anyone suggest how to go about this.
    thanks in advance
    Regards,
    KM
    Attachments:
    Main page Enhancements for Create and Load.vi ‏69 KB

    Hi Bob_Schor,
    I tried using the approach you mentioned. I cant run continuously. I am not able to figure out where i am going wrong. I have attached the updated vi. 
    Hi Hooovahh,
    The link you have posted seem to work with LV2013. I am currently using LV 2011. Can you please update it to 2011. Is OpenG necessary for this?
    Regards,
    KM
    Attachments:
    Main page Enhancements for Create and Load.vi ‏77 KB

  • Problem with checkbox in JTable when using MyTableModel

    Hi all,
    I have been trawling these message boards for days looking for the answer to my question but have not had any success.
    I am extending AbstractTabel model to create MyTableModel which returns a vector containing the results of a MySql query. One column in this query returns a "0" or "1" which I then store as the boolean value into the vector so that it is rendered as a checkbox on the screen.
    I have also overridden the setValueAt method. THe problem is that when I attempt to check the box in the table, the checkbox isn't actually checking.
    Do I need to implement some sort of listener which picks up the user clicking the box and refresh the model?
    Here is my model code:
    public class MyTableModel extends AbstractTableModel {
        private Vector v = null;
        int listId;
        MyTableModel(int listId){
            this.listId = listId;
            v = new ListItemManagement().getFullList(listId);
       public Class getColumnClass(int c) {
            switch(c) {
                case 6:
                    return Boolean.class;
                default:
                    return Object.class;
        public String getColumnName(int colIndex){
            return ((String[])v.get(0))[colIndex];
        public int getColumnCount() {
            return ((String[])v.get(0)).length;
        public int getRowCount() {
            return (v.size() - 1);
        public Object getValueAt(int rowIndex, int colIndex) {
            return ((Object[])v.get(rowIndex + 1))[colIndex];
        public void setValueAt(Object aValue, int rowIndex, int colIndex) {
            System.out.println("Value: " + String.valueOf(aValue));
            Object row[] = (Object[]) v.elementAt(rowIndex);
            if(colIndex<6){
                row[colIndex] = (String)aValue;
            else{
                row[colIndex] = (Boolean)aValue;
            v.setElementAt(row, rowIndex);
            fireTableCellUpdated(rowIndex, colIndex);
        public boolean isCellEditable(int row, int col) {
            //Note that the data/cell address is constant,
            //no matter where the cell appears onscreen.
            return ! (col < 6);
        }Here is the getFullList function which returns the vector:
                rs = stmt.executeQuery();
                ResultSetMetaData colData = rs.getMetaData();
                int columnCount = colData.getColumnCount();
                String[] columnNames = new String[columnCount];
                for (int i = 0; i < columnCount; i++){
                    columnNames[i] = colData.getColumnName(i + 1);
                Vector v = new Vector();
                v.add(columnNames);
                while (rs.next()){
                    Object[] values = new Object[columnCount];
                    for (int i = 0; i < (columnCount-1); i++){
                        values[i] = rs.getString(i + 1);
                    int sel = rs.getInt("selected");
                    System.out.println(sel);;
                    if(sel==0){
                        values[columnCount-1]=new Boolean(false);
                    else if (sel==1)
                        values[columnCount-1]=new Boolean(true);
                    v.add(values);
                rs.close();
                stmt.close();
                return v;

    Thanks for the replies, much appreciated.
    I've looked at the Swing jtable tutorial and added a TableModelListener and have managed to achieve the desired results but for one thing.
    When I attempt to check the box on the first row of the jTable I get a runtime error:
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayStoreException: java.lang.Boolean
    at project.MyTableModel.setValueAt(MyTableModel.java:65)
    I have been playing around with the setValueAt method and it is in my original post. Here is how it currently looks:
        public void setValueAt(Object aValue, int rowIndex, int colIndex) {
            System.out.println("Value: " + String.valueOf(aValue));
            Object row[] = (Object[]) v.elementAt(rowIndex);
            if(colIndex<6){
                row[colIndex] = (String)aValue;
            else{
                    if(getValueAt(rowIndex,colIndex).toString()=="true"){
                    row[6] = new Boolean(false);
                else{
                    row[6] = new Boolean(true);
            v.setElementAt(row, rowIndex);
            fireTableCellUpdated(rowIndex, colIndex);
        }

Maybe you are looking for