3.2.0

Refreshing the grid with AJAX

Is possible to reload the grid without reloading the HTML page?
I have an AJAX function that returns and loads new js array.
Grid is already rendered on the page.
How to reload this grid with new data?
Boris
July 2,
If it is the same dataset with the changed data - just call refresh() method. There is also an example with 'realtime' updates which calls refresh only for the changed cells in /examples/grid data - realtime/quotes.htm

If you want to replace the data with the different set - call clear(), re-initialize the grid, then call refresh() to repaint.
Alex (ActiveWidgets)
July 2,
Thanks, Alex
I used the following function:

function loadGrid(arrData, resetScroll)
{
obj.setSelectedRows([-1]);
obj.setCurrentRow(-1);
obj.clearRowModel();
obj.setRowCount(arrData.length);

if (resetScroll)
obj.setScrollTop(0);

obj.refresh();

if (arrData.length > 0)
obj.setCellData(arrData);
}//--> end function
Boris
September 12,
so did it work?
September 12,

This topic is archived.

See also:


Back to support forum