2 Replies Latest reply on May 19, 2009 7:41 AM by Gregory Lafrance

    Accessing advanced datagrid individual cell editors to enable disable.

    flashharry! Level 1

      HI,

       

      I did a search on this and could not find a relevant post.

      I have an advanced data grid, bound to an array collection that is being used to edited setting, these setting are checkbox boolean values.
      There are business rules that need to apply based on other forms settings. When a change is made, in this case a combo box, I run through the array collection and alter certain options, this reflects in the grid. I now need to disable the checkboxes in one entire column for all rows(no problem), but I then just need to alter one checkbox in a cell.

      private function processPrimaryGroup():void {

           if (primaryGroupDropDown.selectedIndex > 0) { //if the combo box as anything selected

                for (var i:uint = 0; i < _xSiteGroup.length; i++) {//run through array collection to make changes

                     if (_xSiteGroup[i].groupID == primaryGroupDropDown.selectedItem.data) { //if the select combo box select item matches are array loop

                          _xSiteGroup[i].selected = true; //change array collection settings

                          _xSiteGroup[i].isRadio = true;

                          _xSiteGroup[i].preSelected = true;

                          groupGrid.selectedIndex = i; //select grid so user can see that change it for them

                          //now create a new class factory check box

                          var myCheckBox:ClassFactory = new ClassFactory(CheckBox);

                          myCheckBox.properties = {enabled:false};

                          //THIS IS THE PROBLEM

                          //this affects the entire column, I want to disable JUST the checkbox in this cell.

                          AdvancedDataGridColumnGroup(groupGrid.groupedColumns[2]).children[0].itemRenderer = myCheckBox;

                     } else {

                          _xSiteGroup[i].isRadio = false;

                     }

           }

           //this disables all checkboxes from being edited, in group 2, 2nd column Works!
            var myCheckBox:ClassFactory = new ClassFactory(CheckBox);

           myCheckBox.properties = {enabled:false};

           //this works, sets entire column so check boxes are not editable

           AdvancedDataGridColumnGroup(groupGrid.groupedColumns[2]).children[1].itemRenderer = myCheckBox;

           AdvancedDataGridColumnGroup(groupGrid.groupedColumns[2]).children[1].editable = false;

      }
      Thanks in advance
      Flash                                   

        • 1. Re: Accessing advanced datagrid individual cell editors to enable disable.
          Gregory Lafrance Level 6

          You should always just change the data in the dataProvider collection, and that will be reflected in the UI.

           

          Sometimes you need to use myCheckBox.selected = (data.enabled == 'true' ? true : false) because the data is just strings, and can't cast to Boolean.

          • 2. Re: Accessing advanced datagrid individual cell editors to enable disable.
            flashharry! Level 1

            selecting and un-selecting the checkboxes is not the issue. I can change this in the array collection and they do reflect in the UI.

             

            My issue is there are business rules that equate to either selecting one item from a combo box or multiple items from the grid.

            If a user chooses the combo box option, then I need to deselect all the grid options, bare the one they selected in the combo box. (working)
            I then need to prevent them from selecting any of the options in the grid so I disable the check boxes in the entire column (working)
            There is another column in the grid associated with the setting, I want to disable this checkbox only in that cell, and leave all the other checkboxes in this column enabled.
            How do I bind an array collection property to a cell editor to enable/disable a checkbox?
            TIA
            Flash