ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: jplevene on January 23, 2025, 02:13:59 am
-
I have a grid with dataModel.location="remote"
Just on the first load (one off when data loaded for the first time only) I want to set an initial filter on a column. So when refresh, add/remove filters, etc. it must NOT revert to the initial filter option.
I want to avoid calling the remote server twice.
After building the table, I have tried making the dataModel.location="local", applying the filter then dataModel.location="remote" which works, but is there a cleaner way to set the initial filter in "options"?
I have tried using grid.one like below, however this calls the remote server to load the data twice, being one time to load the initial data (unfiltered) then again after the "one" is called with a new filter.
grid.one("load", function (evt, ui) {
// Apply initial filtering.
grid.filter({
oper: "add",
rules: [
{ dataIndx: "DEPOT", value: ["London"] },
]
});
});
-
There is no need to use load event to apply initial filtering.
The initial filter options can be set just by adding column.filter option. It works same for local and remote filtering.
{ title: "Customer Name", width: 120, dataIndx: "ContactName",
filter: {
crules: [{condition: 'begin', value: 'M' }]
}
},
Remote server is called only once as the filtered data is loaded initially.
-
Thanks. Can't believe I missed that.