Version ignite-ui-full: 18.2.99
My project have problem with IgGrid. I need update data source object manual without API and used property "rowVirtualization=true".When data source large current height grid, scrollbar appearIf I scroll to bottom and update data source by $("#grid").igGrid(dataSourceObject", data).igGrid("dataBind"), the grid auto scroll to top
I want to keep position of scrollbar. Please help me
Hello Quoc,
Another way to keep the scroll position is to use a private property called _persistVirtualScrollTop. You will see the scroll position is persisted after dataBind() by adding the following code right after the grid initialization.
$("#grid").data("igGrid")._persistVirtualScrollTop = true;
Please remember that this property only works with a virtualized grid, and we cannot guarantee it to work in the future versions since it uses a private code.
Thank you,Mihoko Kamiishi
Thanks for you answer. The solution have trouble in IE browser. The user see grid scroll to top and after that scroll to bottom. IE is main browser of us. Can you help me fix that in IE?
Thank you for posting in Infragistics Forum.
You should be able to restore the scroll position by saving the current scroll position and resetting it using igGrid’s virtualScrollTo() method like this:
-----------------//Save the current scroll positionvar verticalContainer = $("#grid_scrollContainer");var topPos = verticalContainer.scrollTop();
//Call dataBind() $("#grid").igGrid("dataSourceObject", data).igGrid("dataBind"); setTimeout(function(){ //Reset the scroll position $("#grid").igGrid("virtualScrollTo", topPos + "px"); }, 0);-----------------
https://www.igniteui.com/help/api/2018.2/ui.iggrid#methods:virtualScrollTo
Please let me know if I may be of further assistance.