2 Replies Latest reply on May 30, 2010 5:10 AM by Flex_

    Editable Datagrid Column

    Flex_ Level 1

      I have to make a datagrid column editable during runtime based on the data. If the column has a specific data then the column should not be editable otherwise it should be editable. Can we do it in flex ? please show some pointers.

        • 1. Re: Editable Datagrid Column
          UbuntuPenguin Level 4

          I don't have any examples , but you should probably have a custom itemrenderer for your datagrid which contains a textarea. In the itemrenderer should override set data( value:Object ):void.  In that function you check a condition to see if the textarea "editable" value should be set to true or false.  Below I have some pseudo-code.

           

          <s:Itemrenderer>

          .....

          override public function set data( value:Object ):void

          {

            if( object.decidingValue > 0  )

            {

               TnA.editable = false;

            }

            else

            {

               TnA.editable = true;

            }

          }

          ....

          <s:TextArea id="TnA" />

          ....

          </s:Itemrenderer>

           

          or you could just put the code in the TextArea declaration

          ...

           

          <s:TextArea id="TnA" editable="{data.decidingValue > 0}" />

           

          (TextInput area is probably more appropriate than a textarea , but the logic is the same )

           

          If this response was helpful please mark it as such.

          • 2. Re: Editable Datagrid Column
            Flex_ Level 1

            Thanks for the response.

             

            The editable property did not work .. but enable="false" worked