To clear the data in JQGrid, you can use the clearGridData
method. Here is an example code snippet that demonstrates how to clear the data in JQGrid:
javascript// Assuming the grid's ID is "myGrid"
$("#myGrid").jqGrid("clearGridData");
In this example, we use the clearGridData
method to clear the data in the grid with the ID "myGrid"
. This method removes all rows from the grid and resets the page information to the first page.
Note that the clearGridData
method does not delete the columns of the grid, so if you need to remove columns as well, you can use the GridUnload
method. This method removes the grid completely from the DOM, allowing you to create a new grid with different columns if needed. Here is an example code snippet that demonstrates how to use GridUnload
:
javascript// Assuming the grid's ID is "myGrid"
$("#myGrid").jqGrid("GridUnload");
In this example, we use the GridUnload
method to remove the grid with the ID "myGrid"
from the DOM. After this method is called, you can create a new grid with different columns by calling the jqGrid
method again with the new column model.
Comments
Post a Comment