Author Topic: grid reset(filter: true) doesn't leave preset (default) filters  (Read 2990 times)

jlawler.scsi

  • Newbie
  • *
  • Posts: 7
    • View Profile
Hi, I'm trying to use the reset method to clear filters that the user has changed, but I don't want PQ to just "null" all of the filters.

I have also defined a preliminary value on one filter like this, in the col's filter array:

Code: [Select]
on: true,
value: ['Open']

but when I use reset:

Code: [Select]
reset({filter: true})

that value is ignored, and that column is not filtered.

Is there a workaround?  I'd argue that based on the spec for reset:

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

Quote
Resets the grid to its initial state w.r.t sorting, filtering and grouping...

it should by default work the way I'm suggesting, because this *is* the "initial state" of my grid.

Thanks

jlawler.scsi

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: grid reset(filter: true) doesn't leave preset (default) filters
« Reply #1 on: June 13, 2018, 10:37:41 pm »
Actually, I should mention that the same is true at least of sort, if 'sort: true' in a reset, sortModel.sorter (if set) seems to be cleared.

I think we should have options to do this one way or the other (or if it's only going to be just one way, it should not be the way it is, rather the original conditions should be restored).

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6200
    • View Profile
Re: grid reset(filter: true) doesn't leave preset (default) filters
« Reply #2 on: June 18, 2018, 05:33:17 am »
You are right, reset word can be misleading, actually reset method is meant to clear filtering, sorting or grouping.

Your requirement could be more aptly handled by state management, please check this example:

https://paramquery.com/pro/demos/grid_state
« Last Edit: June 18, 2018, 09:22:38 am by paramquery »