Specify default filter in jqgrid
Asked Answered
F

2

6

I want to preload a set of filters on initial load of the grid. The reason for this is that I am planning to store the last selected filter in a session variable so the user will come back to the grid as he left it the last time.

I know there is an option to set defaultValue under editoptions for one column, but I am looking for a way to load the whole filter at once. (Not a function for each coulmn).

Flittermouse answered 13/2, 2012 at 17:4 Comment(0)
S
6

I suppose that you use advanced searching for the filtering. The filter is nothing more as the value of postData.filters. See here and the demo from another old answer for details.

Moreover I would recommend you to read the demo where I describe how to use localStorage to save some user preferences of the grid inclusive the searching filter. Moreover I describe why I think the usage of the localStorage the better way as the usage of cookies or session variables.

Spelling answered 13/2, 2012 at 17:20 Comment(1)
Thanks, Oleg. Just what I needed.Flittermouse
W
1

In the column options, add the defaultValue parameter inside the searchoptions option:

searchoptions:{ sopt:['eq'], defaultValue:"SomeValue" }
Williswillison answered 8/5, 2019 at 13:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.