1 Reply Latest reply on Dec 4, 2008 6:05 AM by niksk

    CheckBox in DataGrid - how to check without changing row selection?

    Level 7
      Hi Everyone

      I have a CheckBox set as the renderer/editor for a column in my DataGrid
      and I would like users to be able to check and uncheck the boxes on
      different rows without selecting or changing the selection of the
      current grid row.

      Is this possible? Any help would be very much appreciated.

      Thanks

      Gary Q
        • 1. Re: CheckBox in DataGrid - how to check without changing row selection?
          niksk
          Hey Gary,

          When you are defing the checkbox as itemrenderer then create a new class for that and make one checkbox component in that.
          then in the dataprovider of your datagrid append one <selected>false</selected> tag. Then in your renderer class check for the selected tag like

          override public function set data( value:Object ):void
          {
          super.data = value;

          if(value == null)
          return;

          var xml:XML = XML( data );
          if(xml.selected == "false")
          cbx.selected = false;
          else
          cbx.selected = true;
          }

          }
          private function updateSelected():void
          {
          super.data.selected = cbx.selected;
          }


          [Bindable] public var selected:Boolean;



          <mx:CheckBox id="cbx" width="14" click="updateSelected()"/>
          </mx:HBox>