2 Replies Latest reply on Oct 24, 2007 6:47 AM by 187_2007

    Datagrid Enable/disable

    187_2007 Level 1
      Working on day two here..... What would the proper syntex be for enabling or disabling a specific column ?

      for example: Suppose I have this


      Imagine this is a DataGrid ( yeah I know, I can't draw ):
      -----------------------------------------
      Col1 Col2 Col3
      1 chkbox 1
      2 chkbox 2
      3 chkbox 3
      ----------------------------------------

      if I click [chkbox] I want COL3 row 1 to be disabled.

      I know when I have selected the Checkbox.. I've captured that event.. Now how do i disable the colum beside it? ANy ideas?

        • 1. Re: Datagrid Enable/disable
          ntsiii Level 3
          You can disable the whole column by setting its .editable=false.

          Is that what you want, of do you want to make the adjacent "cell" non=editable? That's much harder, and will require a renderer for that column as well.

          I suspect you will find that the event won't help you, and that you need to use the dataProvider API to update the dataProvider item. This will invoke redraw of the DG, where your Col3 renderer will use the value in Col2 to determine its editable state.

          This is beyond the capability of an "editable" DG, and will need to be implemented as pure item renderers.

          Tracy
          • 2. Re: Datagrid Enable/disable
            187_2007 Level 1
            Yup. I think you're right. I was able to rethink my approach and solve the issue. I simply added a [TextArea] (COL 3) inside the DG.

            <mx:DataGridColumn id="CustomID" textAlign="center" headerText="Custom" dataField="CUSTOM" editable="false" >
            <mx:itemRenderer>
            <mx:Component>
            <mx:TextInput width="100%" text="{data.CUSTOM}" editable="{data.CHK_OVERRIDE}" />
            </mx:Component>
            </mx:itemRenderer>
            </mx:DataGridColumn>

            and made the editable field the data result of my checkbox (COL 2)

            if any of you have questions about this or have the same issu please feel free to reply back to this and I will post the code.