Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: [3.0] this.grid is undefined

  1. #1
    Ext User
    Join Date
    Aug 2009
    Location
    BR
    Posts
    17

    Default [3.0] this.grid is undefined

    Hello
    I need help.
    My grid pattern to other screens (the father) is the problem "random". Sometimes it happens, sometimes not (almost always).
    Seems to be happening in Ext.data.Store the following line:

    Code:
    listeners: {
        'load': function (ste) {
            Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();
        }
    }
    in this line: ->> Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();

    All help is welcome.
    Thank you.

  2. #2

  3. #3
    Ext User
    Join Date
    Aug 2009
    Location
    BR
    Posts
    17

    Default

    Someone to help?
    I need that when open the window, automatically select the first row of the grid.
    Sorry for my English. I'm Brazilian.
    Thanks

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    It's because of deferred rendering. Defer the call for a few milliseconds.

  5. #5
    Ext User
    Join Date
    Aug 2009
    Location
    BR
    Posts
    17

    Default

    what's the command?
    I tried with delay and failed.
    Actually are two tabs, and when I select something in the first tab, the second tab loads the database dependence of the first tab.
    Following is the most complete command:

    Code:
    this.store = new Ext.data.Store({
      proxy: ........ (not necessary)
      }),
      reader: ......... (not necessary)
      },
      fieldsStore),
      listeners: {
        'load': function (ste) {
          Ext.getCmp('grid-' + windowId).getSelectionModel().selectFirstRow();
        }
      }
    });
    
    gridRegister.superclass.constructor.call(this, {
      id: 'grid-' + windowId,
      height: 320,
      title: 'Information',
      border: true,
      loadMask: {
        msg: 'Loading...'
      },
      listeners: {
        render: function (g) {
          g.getSelectionModel().selectRow(0);
        },
        delay: 10
      },
      sm: new Ext.grid.RowSelectionModel({
        singleSelect: true,
        listeners: {
          rowselect: function (sm, row, rec) {
            Ext.getCmp('form-' + windowId).getForm().loadRecord(rec);
          }
        }
      })
    });

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    delay 10 won't be enough because IIRC, after rendering the Grid, the View's final update is only deferred by 10ms, so your listener will be executed too soon.

    I know its a bit crap having to delay arbitrary times, but the next release has a viewready event which will be the right one to hook into to select the first row.

  7. #7
    Ext User
    Join Date
    Aug 2009
    Location
    BR
    Posts
    17

    Default

    Ok.
    Thank's for your help, but yet not solved my problem.

    Sorry, but I'm beginner in ExtJS.

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    OK, back to a problem. What problem, where?

  9. #9
    Ext User
    Join Date
    Aug 2009
    Location
    BR
    Posts
    17

    Default

    The problem is that sometimes not only selects the grid, causing errors. But even so, pass the information on the grid for the form and the second tab (depends on the first tab).
    Only sometimes.

    My English is very bad, sorry.

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    No. I'm lost now.

Page 1 of 2 12 LastLast

Posting Permissions

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