0 Replies Latest reply on Jun 9, 2011 1:41 PM by Wang4181

    Why the first AdvancedDataGridColumn in AdvancedDataGrid can not be disabled?

    Wang4181

      Hi,

       

      I defined a AdvancedDataGrid control, and defined 2 column, the first the AdvancedDataGirdColumn display a name and second AdvancedDataGirdColumn display a checkbox, where the itemList is an array of item whose enable property is the itemRenderer's enable state.

      But I found out that the enable state was not applied to first column.

      If I add a dummy AdvancedDataGirdColumn, so the name becomes second column, then the enable state shows.

      Anyone has the solution? Thanks.

       

      Here is my code:

       

      //nameRenderer.mxml defines a mx:Label to display name

      <mx:Label id="name" height="18" enabled="{_data.enabled}" text="{_data.name}"/>

       

       

      //checkboxRenderer.mxml defines a checkbox to select

      <mx:CheckBox id="check" width="18" height="18" click="setInUse()" selected="{_data.selected}" enabled="{_data.enabled}"/>

       

      //main mxml

      var itemList:ArrayCollection = new ArrayCollection();

       

      // adding item to itemList, where the item has a member - enabled

       

      // AdvancedDataGrid component, here the enable state does not apply to name_col

      <mx:AdvancedDataGrid id="mydatagrid" iconFunction="{null}" folderClosedIcon="{null}" folderOpenIcon="{null}>

       

          <mx:dataProvider>

       

               <mx:HierarchicalData source="{this.itemList}"/>

       

          </mx:dataProvider>

          <mx:columns>

                <mx:AdvancedDataGridColumn id="name_col" dataField="name" editable="false" itemRenderer="views.renderers.nameRenderer" draggable="false"/>

       

                <mx:AdvancedDataGridColumn id="checkBox_col" dataField="selected" editable = "false" itemRenderer="views.renderers.checkboxRenderer" width="18" headerText=""/>

       

          </mx:columns>

       

      </mx:AdvancedDataGrid>

       

      // AdvancedDataGrid component with the first column as dummy, here the enable state applies to name_col

       

      <mx:AdvancedDataGrid id="mydatagrid" iconFunction="{null}" folderClosedIcon="{null}" folderOpenIcon="{null}>

       

          <mx:dataProvider>

       

               <mx:HierarchicalData source="{this.itemList}"/>

       

          </mx:dataProvider>

          <mx:columns>

                <mx:AdvancedDataGridColumn id="dummy_col" width="20"/>

                <mx:AdvancedDataGridColumn id="name_col" dataField="name" editable="false" itemRenderer="views.renderers.nameRenderer" draggable="false"/>

       

                <mx:AdvancedDataGridColumn id="checkBox_col" dataField="selected" editable = "false" itemRenderer="views.renderers.checkboxRenderer" width="18" headerText=""/>

       

          </mx:columns>

       

      </mx:AdvancedDataGrid>