Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    trvd1707 is on a distinguished road

      0  

    Default Problem keeping scroll position after refresh

    Problem keeping scroll position after refresh


    Oops! I posted on general forum and I meant to post it here.

    I have a Ext JS 3.4.0 code that shows 2 grids and it refreshes the datastore of the grids every 10 seconds. The refresh code cannot reset the scroll position and cannot remove the selected row of the grid.

    My code is working on my local machine without a problem, but when I move it to the client's machine, it works for around 30 min and it then resets the scroll position back to {top:0, left:0}

    I'm running the code from within eclipse, everything is the same, just one machine is MAC OS/X in one network and another machine is Windows in another network. Same browser, FF.

    Any ideas of what can be resetting the scroll position?

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      1  

    Default


    We would need to see how you're currently achieving the ability to maintain scroll position between store reloads.

    One of the best solutions is explained here:
    http://www.sencha.com/forum/showthre...l=1#post389908

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    trvd1707 is on a distinguished road

      0  

    Default Trying this solution

    Trying this solution


    I was in fact using something a lot more complex, saving the scroll position before load and restoring it with a delay after load, because Ext JS would reset the scroll position with a delay after the load event was triggered.

    So I tried the approach you suggested and I'm testing it now to see if it works.
    thanks,

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    trvd1707 is on a distinguished road

      0  

    Default It is sort of working...

    It is sort of working...


    I tried the approach you mentioned, of overriding the gridView adding the holdPosition flag and testing it on the onLoad code.

    I'm having a strange behavior on the code. I have two tabs and a grid on each tab.

    My code enables automatic data refreshing only on the active tab. I'm listening to activate and deactivate events for that.

    Activate starts Refreshing and deactivate stops Refreshing

    On the grid data store itself, because I have to also keep the row selected after refresh, I'm listening to beforeLoad and load events. BeforeLoad I save the selected row and on load I restore the selected row.

    Is there a better way to keep the selected row after data store reload()? I'm using lock and unlock on the selection model, but it is not working. It keeps the row selected, but the visual indication (the different background) goes away. The effect is bad, if the user clicks on that selected row again, nothing happens because the selection model thinks it is already selected. If the user clicks on another row, it sects it properly, changing its background. That's why I'm saving the selected row on beforeLoad and restoring it on load events.

    Thanks,
    Teresa

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    17
    Vote Rating
    0
    trvd1707 is on a distinguished road

      0  

    Default Still few problems with scroll

    Still few problems with scroll


    It seems that the scroll position from previous session is being recorded somewhere, because when I refresh the page (refresh on the browser), it shows my new grid with the scroll position that is was in the previous session. How can I make Ext JS forget the scroll position between sessions, on the onReady function?

    Thanks,
    Teresa

Thread Participants: 1