I’ve just starting using AG Grid as i was looking for a better performing grid especially for scrolling large data sets, and so far it is working really good. I prefer this over jqxGrid.
The only issue so far is with the grid replicating itself if i try draw the grid again. In the code below, I called the AG grid ‘myGridContainer’ and it is a container.
The grid is loaded when the button is pressed:
Button1.onclick = function()
{
columnDefs = [
{headerName: "Make", field: "make"},
{headerName: "Model", field: "model"},
{headerName: "Price", field: "price"}
];
rowData = [];
for (let i = 0; i < 10; i++)
{
row = [];
row["make"] = "test";
row["model"] = "test2";
row["price"] = i;
rowData[i] = row;
}
gridOptions = {
columnDefs: columnDefs,
rowData: rowData
};
gridDiv = document.querySelector('#myGridContainer');
agGrid.Grid(gridDiv, gridOptions);
};
The problem happens if the button is pressed more than once, then below happens (another grid is drawn):
Is there something i need to do with the container so that the grid doesn’t keep getting drawn again?
Thanks