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,
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.
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?
I seem to need permission to download that video file.However, I reproduced the issue that the scroll position does not get restored properly when I scroll to the very bottom and call dataBind().Let me look into this problem.
Keeping the scroll position with grid's continuous virtualization enabled may be difficult to achieve with custom code.
May I ask what your exact use case is so that we can look for other solutions?Why are you trying to update the data source object manually without API and keep the scroll position at the same time?
Thanks Mihoko Kamiishi,
I have feature scroll to bottom and focus item when append new item to grid.
Before add line code $("#grid").data("igGrid")._persistVirtualScrollTop = true;I handle by solution:// scroll to to top//scroll to index of new item
It working normal in Chrome. But it appear effect scroll to top before scroll to bottom in IE
I think if I keep current position scrollbar, I can remove effect unexpected in IE
If you wish to append a new row and scroll to the bottom, you may want to consider using igGridUpdating's addRow() method.
https://igniteui.com/help/api/2019.1/ui.iggridupdating#methods:addRow
Thanks Mihoko Kamiishi
The solution used feature "updating" is right