Results 1 to 5 of 5

Thread: EditableGrid use date editor for certain rows, not the whole column

  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    82

    Exclamation EditableGrid use date editor for certain rows, not the whole column

    Is there any way to apply an editor for only certain rows and not the whole column?

    I'm following this example:
    http://dev.sencha.com/deploy/dev/exa...d/edit-grid.js

    And I want to use the following editor it mentions, only for the first row, NOT the whole column:
    Code:
    editor: new fm.DateField({
                    format: 'm/d/y',
                    minValue: '01/01/06',
                    disabledDays: [0, 6],
                    disabledDaysText: 'Plants are not available on the weekends'
                })
    How can I do that???

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    Use the EditorGridPanel's beforeedit event.

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    82

    Default

    Fay, do you have an example of how beforeedit is used by any chance?

  4. #4
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    Something like:

    Code:
     
    var grid = new Ext.grid.EditorGridPanel({
      //...
      listeners: {
        beforeedit: function(e)
        {
          if (e.rowIndex != 0)
            e.cancel = true; // or return false from beforeedit.
        }
      }
    });
    See also: http://dev.sencha.com/deploy/dev/doc...iscelleditable

  5. #5
    Ext JS Premium Member
    Join Date
    Nov 2010
    Posts
    82

    Default

    I tried using beforeedit to format the column as datefield when the user clicks on the first row:
    Code:
    listeners   : {
                beforeedit : function(e) {
                    if (e.row == 0){
                        e.grid.getColumnModel().setEditor(e.column, gridDateField);                    
                    } else {
                        e.grid.getColumnModel().setEditor(e.column, gridTextField);                    
                    }
                }
            }
    This almost works, basically it formats the first field as a date.
    Then on the second row, field one it is treated as text and that works fine, but then i click the next row down (row 3) same column and it doesn't allow me to edit and fires this error in firebug:

    Code:
    this.field.getEl().dom is undefined
    [IMG]chrome://firebug/content/blank.gif[/IMG]Ext.DomHelper=function(){var s=null,j=...emoting=Ext.direct.RemotingProvider;

Similar Threads

  1. editablegrid (in column) layout problem
    By benimben61 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 2 Nov 2009, 7:52 AM
  2. Replies: 1
    Last Post: 6 Oct 2009, 7:14 AM
  3. Replies: 0
    Last Post: 27 Jan 2008, 6:04 PM
  4. EditableGrid>Inserting newly created rows>How to set ID of new record?
    By everknown in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 1 Jun 2007, 2:44 PM

Posting Permissions

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