1. #1
    Ext User
    Join Date
    Nov 2010
    Posts
    7
    Vote Rating
    0
    matjumbo is on a distinguished road

      0  

    Question need a help about the gridpanel`s store refresh

    need a help about the gridpanel`s store refresh


    i did a gridpanel,want to keep the scrollbar`s state when the gridpanel refresh.
    i can get the scrollbar`s top,left when the store beforeload use 'getScroll() ',and save it to store like 'store.scrollsObj'
    then i did code in the event 'load',
    Code:
    var showPanle = tab.getGridEl().down('.x-grid3').down('.x-grid3-viewport').down('.x-grid3-scroller')
    showPanle.scrollTo('top',store.scrollsObj.top+10);
    showPanle.scrollTo('left',store.scrollsObj.left+10);
    when i break debug it ,i find it can do ,but when the gridpane fresh over the scrollbar also go to left:0,top:0
    why?
    shoud i take another event?

  2. #2
    Ext User
    Join Date
    Nov 2010
    Posts
    7
    Vote Rating
    0
    matjumbo is on a distinguished road

      0  

    Default


    who can help me

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    So you want:
    Code:
    var state;
    grid.getStore().on({
      beforeload: function(){
        if (grid.rendered) {
          state = grid.getView().getScrollState();
        }
      },
      load: function(){
        if (state) {
          grid.getView().restoreScroll(state);
        }
      }
    });

  4. #4
    Ext User
    Join Date
    Nov 2010
    Posts
    7
    Vote Rating
    0
    matjumbo is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    So you want:
    Code:
    var state;
    grid.getStore().on({
      beforeload: function(){
        if (grid.rendered) {
          state = grid.getView().getScrollState();
        }
      },
      load: function(){
        if (state) {
          grid.getView().restoreScroll(state);
        }
      }
    });
    thanks! that's right!

  5. #5
    Sencha User
    Join Date
    Aug 2009
    Location
    France
    Posts
    44
    Vote Rating
    0
    shinkenno is on a distinguished road

      0  

    Default


    Hi,

    I am trying to achieve the same goal (i.e. keeping the scroll position when the grid is refreshed). The store is automatically refreshed every 5 seconds (by an ajax call) with the function:
    Code:
    RealtimeStore.loadData(realdata);
    This function does not fire the beforeload event, so I tried another way by monitoring the bodyscroll event of the grid panel with:
    Code:
    var realtimeGridState;
    RealtimeGridPanel.on({
      bodyscroll: function(){
        if (RealtimeGridPanel.rendered) {
            realtimeGridState = RealtimeGridPanel.getView().getScrollState();
            console.log('Store ',realtimeGridState);
        }
      }
    });
    and reloading the scroll state on the store reloading (as explained in the previous posts):
    Code:
    RealtimeGridPanel.getStore().on({
      load: function(){
        if (realtimeGridState) {
            RealtimeGridPanel.getView().restoreScroll(realtimeGridState);
            console.log('Load ',realtimeGridState);    
        }
      }
    });
    The realtimeGridState is well registered (log are correct), but no matter what, the scroll position is always reset to 0,0 when the grid is refreshed.
    Any idea of what is happening?

    Thank you!

    NB: using ExtJS 3.4.1

Similar Threads

  1. store.remove(rec) doesn't refresh, but store.removeAll() does?
    By ekhanh101 in forum Ext 3.x: Help & Discussion
    Replies: 9
    Last Post: 23 Nov 2010, 5:34 AM
  2. How to refresh GridPanel?
    By ctp in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 25 Oct 2010, 9:23 PM
  3. How to refresh a gridPanel?
    By mainmich in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 17 Jun 2010, 3:10 AM
  4. How to refresh GridPanel
    By silcreval in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 29 Dec 2008, 5:11 AM
  5. gridpanel store.loadData doesnt refresh data
    By onedaysale in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 13 Aug 2008, 11:18 AM

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi