ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: orlando_acevedo on July 14, 2017, 12:34:44 am
-
Hello all,
What would be the best way to detect when a new filter is triggered (before calling getData), clear the current data and then call refreshDataAndView with the new filter?
At the moment, when a filter is changed, the new data is just added to the current one.
Thank you,
Orlando
-
Events like filter, filter change listener can be used to detect change in filter.
IN this example https://paramquery.com/pro/demos/infinite_scroll
filter change listener is used to clear the current data cache, call filter method which calls the remote script with new filter parameters.
filter: {
condition: 'begin',
listeners: [{ 'change': function () {
pqIS.init();
var $grid = $(this).closest(".pq-grid");
$grid.pqGrid('filter', {
oper: 'replace',
data: [{ dataIndx: 'company', value: $(this).val()}]
});
}
}],
type: 'textbox',
value: 'P', on: true
}
-
Thank you for the reply.
This function replaces the entire filter, which means it will ignore the previous fields that have been filtered. Is there a way to restrict the replace to its own column?
-
Sure, just use oper: 'add' instead of oper: 'replace' in filter method.
-
Thank you for the information!