Author Topic: AND condition in filter  (Read 2808 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
AND condition in filter
« on: April 12, 2019, 02:12:39 pm »
Would it be possible to make use of search keywords in filter textbox?, ex contain condition:

term AND term
term OR term


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: AND condition in filter
« Reply #1 on: April 12, 2019, 07:00:45 pm »
Yes you can call filter method.

https://paramquery.com/pro/api#method-filter

condition is passed as mode parameter.
« Last Edit: April 12, 2019, 07:06:06 pm by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: AND condition in filter
« Reply #2 on: April 15, 2019, 02:04:03 pm »
Thanks, not sure I understand though. I want the user to be able to set conditions (AND, OR) by using those keywords directly in textbox.

Tried:
filter: { rule: { mode: 'AND' }, crules: [{ condition: 'contain' }]....

but not working...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: AND condition in filter
« Reply #3 on: April 16, 2019, 02:09:04 pm »
Please ensure the parameters are passed correctly as per the documentation API.

Substitute mode and values by user entered values.

Code: [Select]
grid.filter({
    rules: [
        {
            dataIndx: 'dataIndx of field',
            mode: 'OR',
            crules: [
                { condition: 'contain', value: a },
                { condition: 'contain', value: b }
            ]
        }
    ]
});

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: AND condition in filter
« Reply #4 on: April 30, 2019, 02:38:14 pm »
Thanks, still don't get it right though...would it be possible to see a working demo of this?