<pre name= "Code" class= "JavaScript" >$ ("#gridId"). Trigger ("Jqgridselectall");//Select all rows, and no response after the call
$ ("# Gridid "). Trigger (" Reloadgrid ");//reload data, call success
The Jqgridselectall trigger event is listed in Jqgrid's official documentation, but we use $ ("#gridId"). Trigger ("Jqgridselectall") trigger without any effect, I'm following the definition of the Reloadgrid trigger event.
. bind (' Reloadgrid ', function (e,opts) {
...
}
But in the Jqgrid source code did not find jqgridselectall similar definition, so using JS trigger Jqgridselectall event has no effect, by modifying the Jqgrid source we can achieve jqgridselectall all-in-select events, $.fn.jqgrid = function (PIN) {} method populate (); ts.p.hiddengrid=false; Add the following code after
$ (TS). bind (' Jqgridselectall ', function (e,checkflag) {
if (e.istrigger===2) {
return;
}
$ (' #cb_ ' +ts.id). attr (' checked ', (checkflag===false));
$ ("#cb_" +ts.id). Trigger ("click");
$ (' #cb_ ' +ts.id). attr (' Checked ',! ( Checkflag===false);
});
Select all:
$ ("#gridId"). Trigger ("Jqgridselectall", true);
Cancel Select all:
$ ("#gridId"). Trigger ("Jqgridselectall", false);