ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on November 16, 2016, 02:28:29 pm

Title: Filter condition
Post by: queensgambit9 on November 16, 2016, 02:28:29 pm
Hi, Im using:

Code: [Select]
$("#grid_array").pqGrid( "filter", { oper: 'replace', data: [
            { dataIndx: 'Column1', condition: 'equal', value: '0'},
            ]})

to set a filter...Would it be possible to add expression OR like 'Column1' == '0' OR 'Column2' == '0'?
Title: Re: Filter condition
Post by: paramvir on November 16, 2016, 02:35:15 pm
That would be

grid.filter({
    oper: 'replace',
    data: [
          { dataIndx: 'Column1', condition: 'equal', value: '0'},
          { dataIndx: 'Column2', condition: 'equal', value: '0'}
    ]
});

and set mode = "OR" in filterModel

http://paramquery.com/pro/api#option-filterModel
Title: Re: Filter condition
Post by: queensgambit9 on November 16, 2016, 06:30:19 pm
Thanks, works fine.

Question...since I change the filterModel from default (AND) to (OR), I would like to restore after the filter is executed:

Code: [Select]
$("#grid_array").pqGrid( "option", "filterModel", { on: true, mode : "AND" } );
However this removes the filter header?

Also, regarding the filter condition...if I for the same column would like to filter on value: 1, 2 and 4...how would that looke like?
Code: [Select]
{ dataIndx: 'test', condition: 'equal', value: '0'}, // add value 1, 2 and 4...
 
Title: Re: Filter condition
Post by: paramvir on November 16, 2016, 08:11:50 pm
Quote
$("#grid_array").pqGrid( "option", "filterModel", { on: true, mode : "AND" } );

However this removes the filter header?

use $("#grid_array").pqGrid( "option", "filterModel.mode", "AND" );


Quote
if I for the same column would like to filter on value: 1, 2 and 4...how would that looke like?
Code: [Select]
{ dataIndx: 'test', condition: 'equal', value: '0'}, // add value 1, 2 and 4...

use { dataIndx: 'test', condition: 'range', value: [1,2,4] },
Title: Re: Filter condition
Post by: queensgambit9 on November 17, 2016, 08:17:07 pm
Thanks. Is it possible to have more advanced expressions?

Code: [Select]
$("#grid_array").pqGrid("filter", {
oper: 'replace', data: [
    { dataIndx: 'Indx1', condition: 'equal', value: '1'},
    { dataIndx: 'Indx2', condition: 'equal', value: '2'},
    { dataIndx: 'Indx3', condition: 'equal', value: '3'}
]});

Like:
((Indx1 == '1' OR Indx2 == '1') AND Indx3 == '1') ?

Title: Re: Filter condition
Post by: queensgambit9 on November 24, 2016, 06:46:38 pm
Would the above be possible?
Thanks.

Title: Re: Filter condition
Post by: paramvir on November 24, 2016, 06:56:20 pm
Such conditions are not supported.