ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: JUNZHONG on December 15, 2015, 02:10:04 am
-
Below is the piece of code which we used to repopulate the filter which user has applied earlier. This is not getting called. Can you please let us know the changes.
//for showing saved filters
$grid.one("pqgridload", function (evt, ui) {
if (typeof filterObject !== 'undefined' && filterObject.length > 0) {
$("#grid_procedure").pqGrid( "filter", {
oper: 'add',
data: filterObject
});
var grid = $grid.pqGrid("getInstance").grid;
grid.refreshView();
}
});
-
This is a DOM based event listener.
These are changes:
1) Type of event is "pqGrid:load" instead of "pqgridload"
2) option trigger should be true i.e., trigger: true
Ref: http://paramquery.com/pro/upgrade#option-general
-
ok I changed accordingly
$("#grid_procedure").on("pqGrid:load", function (evt, ui) {
if (typeof filterObject !== 'undefined' && filterObject.length > 0) {
$("#grid_procedure").pqGrid( "filter", {
oper: 'add',
data: filterObject
});
var grid = $grid.pqGrid("getInstance").grid;
grid.refreshView();
}
});
Here
$("#grid_procedure").pqGrid( "filter" -> is getting called recursively. Now can I not use the filter in the load method for the same grid?
-
It's because you changed one() to on()
-
Great help buddy. That worked. Thank you so much!!!