Search code examples
jsgrid

How to clear all data is jsGrid?


There are many answers on how to clear the data from the similarly-named jqGrid, but I can't find any way to clear data from jsGrid. I just want to delete all rows and reset the grid to its default, with no rows.

I do see a Batch Delete method here, but it works with checkboxes and conditionals and I'm not seeing how to simply delete all rows unconditionally.


Solution

  • You can set data option to empty array:

    $("jsGrid").jsGrid("option", "data", []);