Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Scrolling togrid row (bug?)

  1. #11
    Sencha User
    Join Date
    Jul 2014
    Posts
    28
    Answers
    1

    Default

    Hello Skirtle, thank you for your support. I found a work around based on some of the info you have given me. The following is what I am now using:

    Code:
    handler: function() {
           
           var view = grid.getView();
               rowEditing.cancelEdit();
               var r = Ext.create('User', {
                                name: null,
                                email: null,
                                active: false
                            });
    
    
    
    
                            userStore.insert(0, r);
    
                      //calculate pixel sizes I want to scroll.
                        var lengthOfStore = grid.store.getCount();
                        var scrollLength = lengthOfStore *30;
                            
                        grid.view.scrollBy(0,scrollLength); 
                         //Scrolling to grid has been replaced by 'scrollBy', and the length I have designated
    
    
                      window.setTimeout(function(){rowEditing.startEdit(r,0);}, 100);        
                           //instantly starting the rowEditing function deactivates the rowEditor, because the scroll needs to be completed first.
    
    
                  }
    Dirty, but does the trick.
    Thanks for all your support!

  2. #12

    Default

    Thanks for this discussion. Had the same problem after upgrade from 5.0 to 5.1 where the grid's getRow() function obviously can't catch the recently added row(s) after a store load in time. However the approach with scrolling by a specific number of pixs works in 5.1.

  3. #13
    Sencha Premium Member
    Join Date
    Apr 2014
    Posts
    13
    Answers
    1

    Default And the real answer is...

    I know this thread is old, but I'm going to post this anyway as I'm sure others will stumble upon this thread, looking for the answer.

    The answer already accepted here is not really very efficient. There's a lot easier way to accomplish this in one line. First, you have to understand that, as of version 5.0, all grids include the BufferedRenderer plugin by default, unless you set the grid's bufferedRenderer config to false.

    Assuming you have only one plugin in your grid (e.g., the default BufferedRenderer), the code is:

    Code:
    grid.getPlugins()[0].scrollTo(store.getCount());

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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