2 Replies Latest reply on Dec 17, 2008 6:31 AM by robbyzz

    Mod editable property on DataGrid

      I have a DataGrid and with a button I need to change DataGrid editable into true or false.
      My DataGrid has id="UsersList". I tried with
      private function change_status():void {
      <mx:Button x="151.5" y="320" label="Mod" click="change_status()"/>

      but not work....is it possible to change dinamically this property with a button ?
        • 1. Re: Mod editable property on DataGrid
          amol bhandwale
          this is possible to change the editable property of datagrid.
          but u can edit the existing rows in the datagrid only not the new row.
          u hve to give dataprovider to datagrid.

          may be this helps u
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"
          horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" viewSourceURL="srcview/index.html">

          <mx:XMLList id="employees">
          <name>Christina Coenraets</name>
          <name>Joanne Wall</name>
          public function change():void{
          dg.editable = true;
          public function change1():void{
          dg.editable = false;
          <mx:Panel title="DataGrid Control" layout="vertical" color="0xffffff" borderAlpha="0.15" width="500"
          paddingTop="5" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">
          <mx:Label width="100%" color="0x323232"
          text="Select a row in the DataGrid control."/>
          <mx:DataGrid id="dg" color="0x323232" width="100%" rowCount="3" dataProvider="{employees}">
          <mx:DataGridColumn dataField="name" headerText="Name"/>
          <mx:DataGridColumn dataField="phone" headerText="Phone"/>
          <mx:DataGridColumn dataField="email" headerText="Email"/>
          <mx:Button click="change()" label="true" color="#000000"/>
          <mx:Button click="change1()" label="false" color="#000000"/>


          • 2. Re: Mod editable property on DataGrid
            robbyzz Level 1
            Thank you, now it works correctly. :-)