WinForms - Data Grid - New Find Panel Options (v19.1 CTP)

WinForms Team Blog
20 March 2019

In the recent CTP blog post we mentioned new functionality for the Find Panel. The CTP is available now to all active Universal and DXperience subscribers and in this post I will describe the new functionality in more detail.

If you have the DevExpress Demo Center installed, open the WinForms Data Grid's Find Panel demo and search for a string like administrator Sweden. If you are using the CTP installation, the Data Grid will find only one match: a Swedish company where the Contact Title contains the text Order Administrator.

In version 18.2 or below, you will see more matches: all administrators, and all Swedish companies.

Old Search Result

What changed? Our search engine handles each word of the Find Panel text separately. Starting with v19.1 CTP, we added an option to specify the operator used to combine search criteria.

In older versions, the Data Grid used the OR operator in most cases, but for certain scenarios it switched to AND automatically (here’s the documentation for that behavior).

The New ParserKind Option

Based on your feedback we decided to simplify this mechanism. We introduced the option OptionsFind.ParserKind which supports several modes:

  • Mixed - this is the legacy mode that makes the search engine behave just like it did in versions up to and including v18.2.
  • Exact - the search engine does not split the search query at word boundaries, thereby searching for exact matches. This behavior was available previously by using quotes around search expressions.

Exact Search

  • Or - search words are combined with the OR operator. It is possible to specify column names as before, but the operator doesn’t change.

Or Search

To explicitly use the AND operator in this mode, a word can be prefixed with a + (plus) character:

Explicit And in Or Search

  • And - search words are combined with the AND operator.

And Search

It is possible to explicitly change the combination operator to OR for individual words by prefixing search words with a ? (question mark) character.

Explicit Or in And Search

  • Custom - in this mode you need to handle the ParseFindPanelText event to control the processes of parsing the search text into a filter expression and highlighting row content in the Data Grid.
  • Default - equal to And for v19.1, and Mixed for the older versions.

The Condition Property

In addition to the ParserKind option we also added the property Condition to specify how individual string values are compared. The settings are self-explanatory: Contains (this is the default), StartsWith, Equals, and Like. Note that Condition is only evaluated when ParserKind != Mixed – again, we want to prevent breaking changes when default settings are used.

Condition

New Global Options

We introduced global options in WindowsFormsSettings which are equivalent to those on the Data Grid itself. They are called FindPanelParserKind and FindPanelCondition. These settings are automatically applied to all Data Grids that have ParserKind or Condition set to Default.

Your Feedback Counts

We believe that the two new options make a large difference to the way end users work with the Find Panel. For v19.1 they are only available for the Data Grid, but depending on your feedback we will consider supporting them for other data-aware controls like the Tree List or the Vertical Grid. Please submit your responses to the short survey below, and feel free to leave comments below or open Support Center tickets for further discussion.

Free DevExpress Products – Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We’ll be happy to follow-up.
Christopher Jay
Christopher Jay

Boy, do I wish this was implemented years ago.  I had to add a lot of these options manually using an inherited grid about 6-7 years ago and it will be nice to eventually migrate to your implementation instead of the hoops we had to go through before.  Thanks for adding these options and also for the global defaults.

20 March 2019
Christopher Jay
Christopher Jay

It would be nice if you could add an option like "ShowParserKindOptionOnFindPanel" to allow users to select their preferred search method without us having to manually modify the Find Panel to add this option.

20 March 2019
Daniel Hüttenberger
Daniel Hüttenberger

Thank you for the AND.

Great. I'm waiting for this.

Cheers

20 March 2019
FlugerSoft
FlugerSoft

+1 Christopher Jay>>> option like "ShowParserKindOptionOnFindPanel"

20 March 2019
Paul Kubb
Paul Kubb

the above feature is far more than enough, please also concern on performance a well, especially against more than 100k rows.

should you have some more options on perfirmance such as find only visible columns or specifc columns?

20 March 2019
Dmitry Babich (DevExpress)
Dmitry Babich (DevExpress)

@Paul

Yes, it's possible to specify search columns. Use the OptionsFind.FindFilterColumns property.

20 March 2019
John Fedak
John Fedak

We too had implemented "Exact" manually.

And like the commenter above it would be good to have configuring options available to end users via controls right on the find panel.

20 March 2019
Customer69806
Mikael 69806

This is realy helpful. Thanks!

20 March 2019
Cedrus Bank SAL
Cedrus Bank SAL

The global options is great as well. Many thanks.

20 March 2019
Debeściak
Debeściak

Could you add options to ser case insensitive? Databases like db2 or postgress  are case sensitive and it was grat option to Allow override these setting

21 March 2019
Customer69806
Mikael 69806

Excellent! We will use this in our applications directly when it is launched.

21 March 2019
Simon Hewitt
Simon Hewitt

Sounds good!

I agree with the suggestions to include the option to show the search options directly on the Find Panel - no matter what you finally choose as defaults, there will always be alternate uses.

22 March 2019
Sven H
Sven H

Oliver, one question. When using StartsWith and say I have an entry "New York" and I seach for York, will it match my entry?

We have custom code here to get this working and it would be nice if we wouldn't require it.

We name it "word starts with" and split each entry into different words that we try to match. A separator between words is not only space but also - and similar things.

22 March 2019
Nemo
Nemo

Please focus on adding new features to master detail view in Winforms grid.

22 March 2019
Dmitry Babich (DevExpress)
Dmitry Babich (DevExpress)

@Nemo

Would you please describe in detail what features you want to see in the future?

25 March 2019
Dmitry Babich (DevExpress)
Dmitry Babich (DevExpress)

@Sven

If you have custom separators (not only space), it looks like the Custom mode is what you need. Feel free to post a new ticket in our Support Center or email us at support@devexpress.com. We will provide you with required instructions on how to simplify your code by using this mode.

25 March 2019
Chandrakumaran
Chandrakumaran

Looks great.

Hope this option will be available for the end-user.

Is there any option to search value as a string in a numeric column. The user needs both data type options for search.  If the user can convert a numeric column into a string for the search purposes if allowed to do so.

31 March 2019
Dmitry Babich (DevExpress)
Dmitry Babich (DevExpress)

@Chandrakumaran Sinnappah

Yes, it's possible to search in numeric columns as well. Try running the XtraGrid demo, show the Find Panel and type, for example, "75" in the search box. You will see this result.

If this is not what you are looking for, please post a new ticket in our Support Center or email us at support@devexpress.com.

1 April 2019
Mar c
Mar c

finnnally... MY users were never able to grasp the concept of using + operators.

thanks for listening (even if it took a while)!

2 April 2019
ima_aa
ima_aa

would be nice if the parser unterstands accents and hačeks out of the box

23 April 2019

Please login or register to post comments.