Hello
The Wingrid in my application is populated on runtime from the database. I need to implement a search functionality in all the grids. Is there any built in functionality associated with the control? Or please share your thoughts on making the search of an item possible in Wingrid.
Thanks in Advance
jeni
Hi Jeni,
The link I posted above shows how to loop through a single column and find a match. So you could take that code and do the same thing for every column in each of your grids.
But once you have your matches, what exactly do you intended to do with them? The sample code just scrolls that cell into view, but if you have multiple cells in multiple grids, what are you going to do with them? I suppose you could display a list of the matching cell in a ListView or something like that and let the user pick one. Or maybe highlight those cells with a ForeColor/BackColor?
Hello Mike
Thanks for your reply.
Is there any possibility of adding text in a search textbox, and finding the occurrence of that item in all the columns in the ultragrid.?
I am working on many ultragrids in different tabs in the same form. I need to search on flat data.
My plan is to to allow a search textbox for each grid, so that the text in it is searched on the associated grid.
Any workaround for achieving this?
Thanks in advance.
Jeni
There's no built-in search functionality in the grid. Searching varies so much by application that it's pretty tough to come up with a generic way to implement it. And the grid doesn't have any way to search that is more efficient than what you could implement yoursef - looping through the rows.
The grid has filtering, of course. So using the FilterRow might be a good option for you.
If you want to search, though, how you do it depends any number of factors like:
Are you searching hierarchical data or just flat data?
Which column(s) do you want to search?
What is your search criteria?
Do you want to search by Value or by Text?
There's a KB article which demonstrates how to do a simple keyboard search on a flat grid that might point you in the right direction: HOWTO:How can I make UltraWinGrid allow keyboard searching?
If that's not what you are looking for, then maybe you could reply with answers to some of the questions above and I could whip up some sample code for you.