Updating data in Slick Grid

I have a slickgrid, about 100 rows. Its data is updated within 5 seconds, but with each update it causes concern, scroll reset. I tried using dataview and dataview.refresh (), but this time no changes are reflected in the grid.

Here is what I tried with each update:

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()
+5
source share
5 answers

I 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.

+3
source

You should try the method invalidate

grid.invalidate();

From personal experience, all you have to do to update the grid is to use the method invalidateprovided in the grid. This updates everything and also saves the scroll.

, , ?

+5

just use

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

invalidate: mean nead to check which row you want - in this case: there is no parameter line id = all row

+3
source

I called the following code:

        mapMemoryDataView.beginUpdate();
        mapMemoryDataView.setItems(pointsRows, "id");
        mapMemoryDataView.endUpdate();
        mapMemoryDataView.syncGridSelection(pointsGrid, false);

        for (var i = 0; i < pointsRows.length; i++) {
            mapMemoryTableGrid.updateRow(i);
        }

        mapMemoryTableGrid.invalidate();
        mapMemoryTableGrid.render();
0
source

What worked for me:

    events[v_current_row_num].field_id = v_new_field_id;
    events_grid.updateRowCount();
    events_grid.render();

I use different grid names and views, but the concept revolved around calling updateRowCount functions and rendering.

0
source

All Articles