Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dojo scroll problem with DataGrid

I have problem in DOJO with DataGrid. I refresh my grid on every 1 sec with this code

window.store_data_log= new dojo.data.ItemFileReadStore({data:{items:temp}});
var grid = dijit.byId("grid_log");
grid.setStore(window.store_data_log);

and it works fine ( put new data ). Problem is that when I have lot off rows and I scroll down, my grid refreshs and my scroll goes on top grid. How to solve this ?

like image 230
Damir Avatar asked Aug 30 '26 05:08

Damir


1 Answers

Of course, you are totally clearing the store and resetting it every second from scratch. When you reset the store, you basically reset the grid. I would expect nothing less than the grid resetting the scroll position when you refresh its store.

You may want to learn how to properly use the store rather than just trying to reset it. I answered this here:

How to refresh datagrid

If you use dojo properly, you will get good results, but by just taking a shortcut and trying to refresh the store every second you are going to get an unusable grid.

You need to take a step back and solve your application architecture and not expect the grid refresh to be some kind of magic solution.

like image 170
Tom Gruner Avatar answered Sep 02 '26 16:09

Tom Gruner