3 Replies Latest reply on Jan 8, 2009 7:46 AM by Newsgroup_User

    AdvancedDataGrid editable cells as objects

    willkanoff
      I use AdvancedDataGrid every cell of which is an instance of GridCell class.
      Function to display data:


      function dataGridCellLabelFunc(item : Object, col:AdvancedDataGridColumn) : String {
      if (item[col.dataField] is DateGridCell)
      return GridCell(item[col.dataField]).value;
      }

      For editing itemEditor CellEditor (editorField = "cell"):

      public class CellEditor extends UIComponent
      implements IListItemRenderer, IDropInListItemRenderer, IFocusManagerComponent {

      private var _cellEditor:TextInput;
      ...
      public function get cell(): GridCell {
      var dgOwner: AdvancedDataGrid = owner as AdvancedDataGrid;
      var dgColumn:AdvancedDataGridColumn =
      dgOwner.columns[AdvancedDataGridListData(listData).columnIndex];
      var c: GridCell = GridCell(data[dgColumn.dataField]);
      if (c.value != Number(_cellEditor.text)) {
      c.value = Number(_cellEditor.text);
      // otherwise calculated cells do not work correctly
      dgOwner.dataProvider.itemUpdated(data, dgColumn.dataField, null, c);
      }
      return c;
      }
      ...

      }

      It appears that the data change after editing takes almost a second (with 20 rows and 14 columns in the table).
      I found that commenting out the following line helps:

      //dgOwner.dataProvider.itemUpdated(data, dgColumn.dataField, null, c);

      but then calculated cells and dataProvider listeners do not work...
      Reducing rowCount down to 4 also eliminates the delay...

      Is there a way to use this approach in AdvancedDataGrid table without significant processing delay in the calculated cells?

      Thanks...