8 Replies Latest reply on Jul 16, 2009 4:42 AM by *Prashant Shelke*

    Editable AdvancedDataGrid columns


      I've got an AdvancedDataGrid which I'm loading dynamically from a RemoteObject call, after a mouse click. The grid is set to editable, but I want the first column to not be editable, how do I do this?


      Thought it'd be something like

      adg.columns[0].editable = false;

        • 1. Re: Editable AdvancedDataGrid columns
          *Prashant Shelke* Level 4

          Yes its right..

          • 2. Re: Editable AdvancedDataGrid columns
            m..... Level 1

            Well it don't work!


            TypeError: Error #1010: A term is undefined and has no properties.
            • 3. Re: Editable AdvancedDataGrid columns


              • 4. Re: Editable AdvancedDataGrid columns
                *Prashant Shelke* Level 4

                Following snippet working for me:


                           <mx:AdvancedDataGrid id="adg" editable="true" />

                            public var adgColumns:Array = new Array();
                            public function init():void
                                var advancedDataGridColumn:AdvancedDataGridColumn = new AdvancedDataGridColumn();
                                advancedDataGridColumn.editable = false;
                                advancedDataGridColumn.headerText = "Non-editable";
                                advancedDataGridColumn.dataField = "test1";
                                advancedDataGridColumn = new AdvancedDataGridColumn();
                                advancedDataGridColumn.editable = true;
                                advancedDataGridColumn.headerText = "Editable";
                                advancedDataGridColumn.dataField = "test2";               
                                adg.columns = adgColumns;
                                var object:Object = new Object();
                                object.test1 = "Test non-editable...";
                                object.test2 = "Test editable...";
                                adg.dataProvider = new ArrayCollection();

                1 person found this helpful
                • 5. Re: Editable AdvancedDataGrid columns
                  m..... Level 1

                  It's a strange one...

                  I think it's trying to set the editable field before the columns exist (though they should be created by that time). This is because I'm setting the dataprovider to the result of a remoteobject call then immediately trying to set the first column to non-editable. I think it might be a bug.


                  Now I've just declared the columns to begin with... could present problems if you don't know what the column names are in advance. But it's an acceptable solution for the moment.


                       <mx:AdvancedDataGridColumn dataField="Name" editable="false" />
                       <mx:AdvancedDataGridColumn dataField="Value" />
                  • 6. Re: Editable AdvancedDataGrid columns
                    *Prashant Shelke* Level 4

                    By keeping your old approach try with

                    Step 1: Set dataProvider



                    public function setColumnNonEditable():void


                          adg.columns[0].editable = false;


                    this can help.

                    1 person found this helpful
                    • 7. Re: Editable AdvancedDataGrid columns
                      m..... Level 1

                      Interesting, not heard about that method...

                      Unfortunately that didn't work, I'm fine with the workaround just now.