Results 1 to 5 of 5

Thread: EditorGridPanel disable editor for certain fields?

  1. #1

    Default EditorGridPanel disable editor for certain fields?

    How to enable/disable column editor based on a field value?

    Example:
    You have a record with two columns:
    - enable_edit (checkbox)
    - value (input field)

    How to enable editing of the value only when enable_edit is true?

    Its worth to mention that this enable_edit is per row, so in one row you might have enabled, and in next disabled.

    Tnx in advance!

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Example:

    Code:
    var grid = new Ext.grid.EditorGridPanel({
      ...
      isCellEditable: function(colIndex, rowIndex) {
        var field = this.getColumnModel().getDataIndex(colIndex);
        if (field == 'value') {
          var record = this.getStore().getAt(rowIndex);
          if (!record.get('enable_edit').getValue()) {
            return false;
          }
        }
        return Ext.grid.EditorGridPanel.prototype.isCellEditable.call(this, colIndex, rowIndex);
      }
    });

  3. #3

    Default Tnx ;)

    Hi Condor!

    Exactly what I needed!

    Tnx for your help!

  4. #4

    Default

    This is exactly what I am looking for. It seems this code is supposed to be plugged into EditorGridPanel.java in gwt-ext source. Can you tell me where exactly to insert it or if it is possible to give me an example code block.

    THanks

  5. #5
    Sencha User
    Join Date
    May 2011
    Posts
    7

    Default

    Thanks Condor...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •