JqGrid 'clearToolbar' without reloading grid
I need to clear toolbar
without reloading the mesh in mine jqgrid
. It should just reset the default toolbar.
I tried to use
$("#TransactionsGrid")[0].clearToolbar();
My grid datatype:local
and I am not using loadonce:true
.
This did toolbar
clean and update the mesh. I don't want this to happen.
Any ideas?
source to share
I'm asking an interesting question.
To implement the requirement, I suggest using register jqGridToolbarBeforeClear
to execute the handler only once. The handler should: 1) unregister as an event handler and return "stop" to prevent reloading the grid:
$grid.jqGrid("filterToolbar", { defaultSearch: "cn" });
$("#clearToolbar").button().click(function () {
var myStopReload = function () {
$grid.unbind("jqGridToolbarBeforeClear", myStopReload);
return "stop"; // stop reload
};
$grid.bind("jqGridToolbarBeforeClear", myStopReload);
if ($grid[0].ftoolbar) {
$grid[0].clearToolbar();
}
});
The corresponding demo shows it live.
source to share