Home › Forums › Guriddo jqGrid JS › Preserve scroll position on reload grid
This topic contains 4 replies, has 2 voices, and was last updated by krisreddy 1 month ago.
Is there way to return the grid to scroll position after using ..trigger(“reloadGrid”)?
Generally no, but can you please give us more detail on jqGrid setup? The question is too common.
Guriddo Support Team
Here’s a scenario – page has 2 grids – grid are loaded from database via ajax with datatype xml
Grid 1 – list all the products
Grid 2 – user selects the product row in Grid 1 – this shows all the orders associated with product
User scrolls down and selects a order item from Grid 2 – this shows form below – where user substitutes the product with a another – This needs to update info in Grid 1 and Grid 2
For Grid 1 we just replace the content of the row using rowid and setRowData
For Grid 2 we have reload the grid to show the newly substituted item and any other changes done for the items by other users. Here in lies the problem – grid scrolls to the top on reload
It would be really useful to maintain user selected row in Grid 2 after the reload – in other words Grid 2 should return to the selected row on reload
Hope this makes sense
I can suggest you one possible solution. For this purpose you will need to use the option scrollrows set to true. See here
1 . Create global (or visible inside the scope) variable let say lastselection.
2 . In second grid set the grid option scrollrows to true
3. When the user select a row in second grid set variable lastselection to that row
4. After the reloading of grid 2 with trigger(‘reloadGrid’) do
In this case the grid will scroll to the selected row.
Thanks! will give this a try
You must be logged in to reply to this topic.
Stay connected with us in your favorite flavor!
Copyright 2014 TriRand LtdAll Rights ReservedRSS