Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data Update in Slick Grid

I have a slickgrid, with about 100 rows. Its data is refreshed in 5 seconds, but it is disturbing at each update the scroll is reset. I have tried to use dataview and dataview.refresh() but this time no change is reflecte to grid.

Here what I tried at each refresh:

mapMemoryTableDataView.beginUpdate();
mapMemoryTableDataView.setItems(data);
mapMemoryTableDataView.endUpdate();
mapMemoryTableDataView.refresh();

if(mapMemoryTableGrid == null)
    mapMemoryTableGrid = new Slick.Grid("#datatableMap1", mapMemoryTableDataView, columns, options);

mapMemoryTableGrid.updateRow(1)
mapMemoryTableGrid.render()
like image 311
enesness Avatar asked Mar 19 '12 14:03

enesness


3 Answers

You should definitely try the invalidatemethod

grid.invalidate();

From personal experience, all you need to do to refresh the grid is to use the invalidate method, provided on the grid. This updates everything and also preserves the scroll.

And by refresh, do you mean you are replacing the data, or updating certain rows?

like image 61
Jibi Abraham Avatar answered Oct 23 '22 18:10

Jibi Abraham


I have called the following

 mapMemoryTableDataView.beginUpdate();
    mapMemoryTableDataView.setItems(data);
    mapMemoryTableDataView.endUpdate();
    mapMemoryTableDataView.refresh();
    for (var i = 0; i < olist.length; i++) {
        mapMemoryTableGrid.updateRow(i)
    }

invalidate and refresh did not cure my problem.

like image 38
enesness Avatar answered Oct 23 '22 17:10

enesness


just use

gridItems.invalidate();
gridItems.render();

invalidate: mean nead to validate which row you want - in this case: no parameter row id = all row

like image 23
Grey Wolf Avatar answered Oct 23 '22 18:10

Grey Wolf