[CLOSED] grid scroll back to top after delete row.

  1. #1

    [CLOSED] grid scroll back to top after delete row.

    Hello,

    After deleting a select row from grid store on client side, the screen should stay on where it was. This works fine with 4.2, but after upgrade to 4.8.2, my grid always goes back to the top.

    I can't reproduce it with a simple grid. My grid columns are dynamically built based on configurations and has many plugins & feathers.

    I wonder if you can give me some hints on where can I check? Any related changes from 4.2 to 4.8?
    I don't see the view was refreshed after store changes, store was not reloaded either. I tried to set dom.scrollTop after delete store, it does not help. (set dom.scrollTop only works if I manually do it from browser after it scrolled to the top)

    Same issue with insert a row.
    Please advise!

    Thanks
    -susan
  2. #2
    Hello Susan!

    This gets tough as it is not reproducible, but I'd say it might have been affected by some of the feather (third party libraries or custom code) you have.

    We in fact recently had this issue. We fixed on our own for Ext .NET 4.2.1. Right next minor release, 4.3.0, Sencha had it addressed upstream, and the "home baked fix" were removed.

    So what's interesting is, you say you were using 4.2 while it worked fine -- and that's exactly the version where the same issue (perhaps triggered in another situation?) was first reported.

    Here some suggestions that can potentially help diagnose the issue you have:
    - Take a look at the issue and its pointed forum threads: #1470.
    - I know this is a bit too hands-on, but as we're diving deeper in your more complex case, you may want to check the commits in the issue above that fixed the issue, maybe they help you understand what's up.

    Alternatively, you can go the pragmatic path and just save and reload the scrollbar position before-and-after the action that breaks it. Here's the playground: Grid Panel > Basic > Simple Array Grid example

    Open the example, then developer tools, and experiment with it:
    - get scrollbar position: App.GridPanel1.getScrollable().getPosition()
    (returns something like {x: 10, y: 165})
    - set scrollbar position: App.GridPanel1.getScrollable().scrollTo({x: 0, y: 200});
    (you can then just provide the value back to scroll wherever you want)

    This is useful if your operation is re-drawing the whole grid (and this would explain why its scroll position is being reset); and with this you could retain the scroll position no matter what.

    Just wire up an event right you click the 'delete' button, and then check grid view events for one (like Refresh). The scroll handler is also in the view context, retaining the example above you could also: App.GridPanel1.getView().getScrollable().getPosition(), so if you're in a view event you can just this.getScrollable().

    All in all, I hope this helps with the issue; if in the process you find a way to reproduce that in a simplified test case, don't hesitate to share!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Fabricio,

    I tried your approach to reset the scollY to a fixed position(600) from the view refresh handler. But it does not work. I found the scroll position is always on top even on the initial display.

    Finally found that I have BufferedRenderer= false in the grid. The scrollY stays after I comment that out. I can also control the scroll pos with your approach.

    Do you have any clue why setting scollY not working with BufferedRenderer= false? Feels like somewhere else resets the position after view handler called.

    I don't remember why I set BufferedRenderer to false, could be a fix for other issues. But for now, I just turn it on, hopefully, the app can pass all tests.

    Thanks!
    P.S I still cannot reproduce this with a simple grid.
  4. #4
    Hello again, Susan!

    There must be something else besides just the BufferedRenderer subsystem. In the example I provided above, if changed just to disable the buffered renderer, it then works. Just in case, from Ext.NET 2 to recent versions, the buffered renderer setting is enabled by default in all grids, and the setting is no longer handled in the store, but rather in the grid itself.

    So if in your example it still uses the old buffered renderer settings, it may be accepted by Ext.NET (and just forwarded down to client side) and is affecting the, now private, buffered renderer class' settings and behavior.

    To set the buffered rendering approach to grids, just set the BufferedRenderer setting as true or false in the grid (not store) settings.

    Other than that, I'm basically out of guesses that could likely help you to debug the issue.
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Thanks Fabricio! I am good on this issue now. Please Close it.

Similar Threads

  1. Replies: 5
    Last Post: Jun 23, 2017, 8:49 PM
  2. [CLOSED] How to set the scroll bar back to top in a gridpanel.
    By arjunrvasisht in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 09, 2015, 10:09 AM
  3. Replies: 1
    Last Post: Jun 25, 2013, 12:14 PM
  4. [CLOSED] RowExpander scroll to top of grid when expanded
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 30, 2011, 1:56 PM
  5. [CLOSED] grid panel - exception on delete row
    By boris in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Oct 28, 2011, 1:50 PM

Posting Permissions