Find Panel
- 5 minutes to read
- Overview
- End-user Capabilities
- Behavior: Search and Filter
- Options
- Search Syntax
- Server Mode Limitations
Overview
The grid can display a find panel that enables users to search for keywords in data.
Note
A detail view should be maximized to allow searching its records.
Tip
The GridLookUpEdit does not support the find panel, use the SearchLookUpEdit.
End-user Capabilities
Keyboard operations
Filter and Search modes
- press Ctrl+F to open the find panel
- press Esc once to clear the panel, press it again to close it
- press the Down Arrow key to move focus from the panel to the grid
Search mode only
- press F3/Enter to go to the next result
- press Shift/Alt/Ctrl+F3/Enter to go to the previous result
Panel visibility
- ColumnView.ShowFindPanel — opens the panel
- ColumnView.HideFindPanel — closes the panel
- ColumnView.FindPanelVisible — opens/closes the panel
- ColumnViewOptionsFind.AllowFindPanel — set to false to prohibit opening the panel
- ColumnViewOptionsFind.AlwaysVisible — set to true to prevent the panel from being closed
Behavior: Search and Filter
You can specify how to show search results.
- Filter — hides records that do not match the query, and highlights results in the view (optionally).
- Search — highlights results in the view and on the scrollbar.
Use the following properties to specify how to show search results:
- for the entire application — the WindowsFormsSettings.FindPanelBehavior property. The Filter mode is applied if this setting is set to Default.
- for the current control — the ColumnView.OptionsFind.Behavior property (see ColumnViewOptionsFind.Behavior). The WindowsFormsSettings.FindPanelBehavior property is applied if this setting is set to Default.
Options
Highlight results
To specify whether search queries are highlighted, use the ColumnViewOptionsFind.HighlightFindResults property.
Specify search queries in code
- ColumnView.FindFilterText — the query displayed in the search box. Setting a value to this property applies the specified query.
- ColumnView.ApplyFindFilter — also applies the query.
- ColumnViewOptionsFind.FindFilterColumns — names of columns in which to search the keywords.
Operation buttons
Use the following properties to show/hide the operation buttons:
Filter and Search modes
- ColumnViewOptionsFind.ShowCloseButton - the X button that closes the panel.
Filter mode only
- ColumnViewOptionsFind.ShowFindButton - the Find button that applies the query.
- ColumnViewOptionsFind.ShowClearButton - the Clear button.
Search mode only
- ColumnViewOptionsFind.ShowSearchNavButtons - the Previous and Next buttons allow users to navigate between search results.
Auto-apply search queries
After a user types in the search box, the search starts automatically or manually depending on the underlying data source. You can use use the ColumnViewOptionsFind.FindMode property to specify this behavior explicitly. The ColumnViewOptionsFind.FindDelay property allows you to specify the delay between entering a query and starting the search.
Search Syntax
Note
Demo Run the XtraGrid demo to see the find panel in action.
Single/multiple keywords: type a single or multiple keywords separated by spaces. For example:
USA
— selects records that contain “USA“ in any column;Germany Spain
— either “Germany“ or “Spain“ in any column.
Exact match of a phrase: put the phrase in quotes. For example,
"Bottom-Dollar Markets"
— selects records that contain the phrase “Bottom-Dollar Markets“ in any column.
A keyword is mandatory between multiple keywords: precede a keyword with “+” (no space between them). For example,
Agent Manager +London
— the selected records should contain “London“, and either “Agent“ or “Manager“ in any column;"Marketing Manager" +"Carine Schmitt"
— the selected records should contain “Carine Schmitt” and “Marketing Manager” in any column.
Exclude keywords: precede a condition with “-“ (without a space). For example,
Manager -Schmitt
— records should contain “Manager”, but not “Schmitt”.
In specific columns only: enter a column name before a keyword followed by a colon (without a space). For example,
City:Madrid
— selects records that contain “Madrid“ in the “City“ column only;Country:USA Manager
— “USA“ in the “Country“ column and “Manager“ anywhere else;"Sales Representative" -City:London
— searches for “Sales Representative“, but not in “London“.
Users can enter incomplete column names. In this case, a control shows records from the first column whose name matches the entered string. For example,
Ci:Madrid
— selects records that contain “Madrid” in the first column whose name starts with “Ci” (“City” in this case).
To specify an exact name or if a name contains multiple words, use quotes. For example,
"Contact Title":Manager
— “Manager” in the “Contact Title” column exactly;
Keywords that have a column name as a prefix are also mandatory. For example,
Country:USA Seattle Portland
— the selected records should contain “USA“ in the “Country“ column, and either “Seattle or “Portland“ in any column;USA Seattle Portland
— the selected records contain “USA“ or “Seattle“ or “Portland“ in any column.
Note
Queries are case-insensitive.
Server Mode Limitations
The find panel has the following limitations in the server mode:
- only numeric and text columns are supported;
- only focused row and selected row scrollbar annotations are supported;
columns that show the custom text instead of the actual values are not supported;
Tip
To use these columns, store the custom text in a data source field and assign the field’s name to the GridColumn.FieldNameSortGroup property. You can also specify the ColumnViewOptionsFind.FindFilterColumns property to exclude these columns from the search.
- only case-insensitive queries are supported. See the How to make the Grid’s filter case- and accent-insensitive in Server Mode Kb article for more information.