ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: niketnaik on June 23, 2022, 11:19:09 am

Title: Filter for more than one column from single header
Post by: niketnaik on June 23, 2022, 11:19:09 am
Hello, I want to filter the data from single header but criteria should be from multiple columns. What i want to achieve is (see sample attaced) I want to have filter on first name field, so when ever user will search by providing the value ( George ) then it will display single result but if user search for (Alcock) then it will display 3 results (1 from first name, 2 from last name). How can i achieve that ??
Title: Re: Filter for more than one column from single header
Post by: paramvir on June 23, 2022, 06:35:23 pm
Please use this filter definition ( with required changes ) for firstname column.

Code: [Select]
                filter: { crules: [{condition: 'contain' }], listener: function(evt, ui){
debugger;
var filterRules = [{ dataIndx: 'firstname', condition: 'contain', value: ui.value},
{ dataIndx: 'lastname', condition: 'contain', value: ui.value}];
this.filter({
oper: 'replace',
rules: filterRules
});
}}
Title: Re: Filter for more than one column from single header
Post by: niketnaik on June 24, 2022, 04:17:21 pm
Thank you for replying. I tried with the solution you provided but it doesn't seem to be working for me. If i apply only one filterRules at single time then it is working perfectly but not with both. Can you please share complete jsfiddle so that i can figureout what i am doing wrong to achieve the desired out put?
Title: Re: Filter for more than one column from single header
Post by: paramvir on June 28, 2022, 12:25:29 pm
Please add mode: 'OR' to filter method.

Code: [Select]
this.filter({
oper: 'replace',
        mode: 'OR",
rules: filterRules
})

Reference: https://paramquery.com/pro/api#method-filter
Title: Re: Filter for more than one column from single header
Post by: niketnaik on June 29, 2022, 12:21:23 pm
Excellent. Working perfectly. Thank you. :)