Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Data Binding
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Collapse]Examples
    [Expand]Conditional Formatting
    [Expand]Data Binding
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Export and Printing
    [Collapse]Filtering
      Examples: Filtering Records
      How to: Apply a Filter to a Column
      How to: Apply a Filter to a View
      How to: Customize the Checked Filter Dropdown List
      How to: Display a Custom String in the Filter Panel when a View's Data is not Filtered
      How to: Dynamically Control Record Visibility in XtraGrid
      How to: Filter Columns that Display RTF Data
      How to: Perform Custom Filtering When the (Custom) Item is Selected in the Filter Dropdown
      How to: Specify a Filter for a View Without Binding It to Any Particular Column
    [Expand]Formatting
    [Expand]General Use
    [Expand]Layout View
    [Expand]Master-Detail
    [Expand]Miscellaneous
    [Expand]Navigation and Selection
    [Expand]Painting
    [Expand]Skins and Look and Feel
    [Expand]Sorting and Grouping
    [Expand]Summaries
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Filter Columns that Display RTF Data

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2907.

In this example, a GridControl contains a Description column that displays RTF data in its cells (using an RichTextBox in-place editor).

By default, when displaying the column's filter dropdown list, this list will contain RTF text, including RTF specifiers, making the text human-unreadable.

This issue can be resolved as shown in the example.A helper unbound column is created that will be used as a substitute when the filtering functionality is invoked for the Description column.

The unbound column's values will be the Description column's values converted to simple text.

When an end-user invokes a filter dropdown list for the Description column, the list will actually display values of the created unbound column.

Here are the steps to implement this approach:

1) A new unbound column (field name:"SimpleText") is created. This column is hidden by setting its Visible and ShowInCustomizationForm properties to false.

2) The SimpleText column's caption is set to the same value as for the Description column, so a user will not notice data replacement.

3) The UnboundColumnData event is handled to populate the SimpleText column with data. The column's values will be the Description column's values converted to simple text.

4) The Description column's FieldNameSortGroup property is set to the unbound column's field name ("SimpleText"). This forces the grid to use values of the SimpleText column when sorting/grouping/filtering is applied to the Description column.

5) Set the Description column's OptionsFilter.FilterBySortField property to DevExpress.Utils.DefaultBoolean.True

How would you rate this topic?​​​​​​​