1. #1
    Ext User
    Join Date
    Aug 2008
    Posts
    14
    Vote Rating
    0
    pmruk is on a distinguished road

      0  

    Default Auto scroll a grid to a specific row

    Auto scroll a grid to a specific row


    Hi,

    I have a gridPanel containing an Store which includes a date column. The grid is sorted in date ascending order by default. I'd like to automatically scroll the grid to the row closest to today's date. I have found that the following both work in the FB console:

    Code:
    grid.getView().focusRow(x);
    Ext.getCmp('theGrid').getView().scroller.dom.scrollTop = y
    but I can't work out what event to listen for in order to fire one of the above. It seems that neither listening for the load event of the store or the render event on the grid work.

    I must be doing something wrong. Could someone help?

    Thanks

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,544
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Use the viewready event.

  3. #3
    Ext User
    Join Date
    Aug 2008
    Posts
    14
    Vote Rating
    0
    pmruk is on a distinguished road

      0  

    Default


    OK, listen for 'viewready' on the GridPanel; makes sense except I can't get it to fire. I'm using version 2.2.1 and although I can find it in the 3.1 docs it doesn't appear under the GridPanel class in the 2.2.1 docs. Is it actually implemented in 2.2.1? Or is there something wrong with my implementation?
    Code:
    var mygrid = new Ext.grid.GridPanel({
        store      : this.store,
        height     : 300,
        width      : 500,
        stripeRows : true,
        listeners  : {
             viewready: function(grid){
                 console.log(grid);
            }
        }
    });
    Thanks

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Please post in the *help* section in the future with these types of questions.

    Moved to help.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,544
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    It's a 3.* event

Thread Participants: 2