Author Topic: Set filter value after initialization  (Read 3188 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Set filter value after initialization
« on: October 07, 2016, 02:58:19 pm »
I would like to apply a value to a filter after initialization. Not the complete filter option, just applying a value.
What would be the best approch?

Tried:

Code: [Select]
colM[1].filter = {value: "test"}
But can't get it to work.

Thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Set filter value after initialization
« Reply #1 on: October 07, 2016, 03:54:30 pm »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Set filter value after initialization
« Reply #2 on: October 07, 2016, 06:43:52 pm »
Thanks, when I try running:

Code: [Select]
$( ".selector" ).pqGrid( "filter", {
    oper: 'replace',
    data: [{ dataIndx: 'column1', condition: 'great', value: 0 }
    ]
});

I get no error, but no value is inserted?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Set filter value after initialization
« Reply #3 on: October 10, 2016, 09:53:13 am »
Please substitute ".selector" with actual selector of grid in your case, verify the dataIndx value and the column should be numeric ( float or integer ) for condition: 'great'.

Please share jsfiddle if still facing the issue.
« Last Edit: October 10, 2016, 09:58:41 am by paramquery »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Set filter value after initialization
« Reply #4 on: October 10, 2016, 02:07:47 pm »
http://jsfiddle.net/v7gscjfy/1/

Trying to set query param in url and then set filter depending on value.
I'm sure there is a better way of doing this so please feel free to advise  :).

Thanks.
« Last Edit: October 10, 2016, 03:02:02 pm by queensgambit9 »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Set filter value after initialization
« Reply #5 on: October 11, 2016, 02:58:30 pm »
As mentioned in my previous post, please substitute ".selector" with actual selector of grid in your case.

And use refreshHeader to show the value in header filter row, when filter method is used.

http://jsfiddle.net/v7gscjfy/3/