zalath
zalath

Reputation: 576

Refreshing the grid after adding rows by code

I'm new to slickgrid. I have a problem with refreshing the grid : just a table with 2 columns "id" and "value". the grid is populated behind the scene like this :

        cpt ++ ;
        var d = [{ id: "item" + cpt, value: "val" + cpt }, ];
        data.push(d[0]);
        grid.updateRowCount();
        grid.render();

the data is updated and can be controled :

        var n = grid.getData().length;
        var t;
        for (var i = 0; i < n; i++) {
            t = t + '\n' + grid.getData()[i].id + ' --> ' + grid.getData()[i].value;
        }
        alert(t);        

but on the screen the new rows are empty. If I edit a row the data appear. if I create lot of rows and use the slider to browse the grid, some data appear but not all.

I thought that "grid.render();" should render the grid with the new data ? I miss something, do I need something more like "grid.refresh ?"

regards

some news :

By raising and lowering the slider several times quickly, all data appear.

ok, the solution :

enableAddRow: false

Upvotes: 1

Views: 5243

Answers (1)

Gerardo Pacheco
Gerardo Pacheco

Reputation: 89

I think that using this

grid.setData(data);
grid.render();

Upvotes: 4

Related Questions