CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Search bar initialization issue on form load

by bob9999 » 01 Oct 2019 16:41

Hi there. I ran into an interesting combination of events so I wanted to share here to hopefully save someone else some time. The search bar or toolbar search is a great way for a user to have multiple filters at a time for grid contents. The issue is that when I had the dataset in the user session so I can share the dataset between forms, the state of the search is remembered in the dataset somehow. So when the form loads again, the search bar is cleared as it is supposed to be but under the hood in the dataset the last search state is still remembered.

So if you are using the search bar feature, make sure your dataset for the grid is on the form as well. This way the dataset is recreated from scratch when the form renders and then the search bar state is also cleared.

I just ran into the situation again for another project and remembered this time I put in to figure this out so I had to remove the search bar since I had to have the dataset in that solution in the user session.

Cheers!
bob9999
 
Posts: 110
Joined: 18 Jan 2019 17:32

by ScottWGast » 08 Oct 2019 19:40

Thanks! It's little tidbits like this that help so much.

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by omonien » 26 Apr 2021 14:56

For those who are interested:
A Grid Search is implemented by applying a filter to the underlying TDataset. IOW, the Dataset will have Filtered := true; which is then kept active.

If you reuse a dataset, then first do a Dataset.Filtered:=false. I do this in Form.OnRender - where I work recursively through all DatasetProviders.
Olaf Monien
Embarcadero MVP Coordinator
www.developer-experts.net
User avatar
omonien
 
Posts: 4
Joined: 25 Feb 2021 15:18


Return to JQGrid

cron

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.