ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: jlawler.scsi on June 13, 2018, 10:34:50 pm

Title: grid reset(filter: true) doesn't leave preset (default) filters
Post by: jlawler.scsi on June 13, 2018, 10:34:50 pm
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 (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
Title: Re: grid reset(filter: true) doesn't leave preset (default) filters
Post by: jlawler.scsi 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).
Title: Re: grid reset(filter: true) doesn't leave preset (default) filters
Post by: paramvir 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