Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello

                                    Is it possible to replace the textual representation of a filter shown on the filter panel with the text from the filter dialog? The last one is more readable and less technical and it would improve the useability.
                                    I've already a custom grid derived from GridView. So I think there must be an easy way to do this.

                                    Hope for your help!

                                    Thanks in advance

                                0

                                Hi,

                                To accomplish this task, you can use localizer or satellites assemblies (The collection of localized DevExpress assemblies).
                                For example :
                                Public Sub New()
                                InitializeComponent()
                                DevExpress.XtraEditors.Controls.Localizer.Active = New MyLoc()
                                End Sub

                                Public Class MyLoc
                                Inherits DevExpress.XtraEditors.Controls.Localizer
                                Public Overrides Function GetLocalizedString(ByVal id As DevExpress.XtraEditors.Controls.StringId) As String
                                If id Is DevExpress.XtraEditors.Controls.StringId.FilterGroupNotAnd Then
                                Return "test"
                                End If
                                Return MyBase.GetLocalizedString(id)
                                End Function
                                End Class

                                Thanks,
                                Andrew

                                0

                                First I would like to thank you for very fast response.
                                But I think there is a misunderstanding. Let me take an example:

                                I create a filter in the grid: column A has to contain "xxx".
                                In the filter dialog I have the wonderful and easy readable textual representation:
                                "[Column A] contains xxx".
                                But the filter panel shows:
                                "[Column A] Like '%xxx%'"
                                With the solution you posted before I could replace the "Like" with "contains". But there are still the quotation marks and the percent signs. And that’s only a very simple example. How about "is between" and "is blank"? It’s not only a question of replacing certain words. The whole filter criteria are differently represented.
                                I’m looking forward to your answer.

                                0

                                Hi Dirk,

                                Thank you for the clarification.
                                To display required text in the filter panel, please handle the ColumnView.CustomFilterDisplayText Event event.

                                Thanks,
                                Andrew

                                0

                                Hello again,

                                I’m sorry to say, but I think you didn't get what I want to do.
                                I already know that I can change the text on the filter panel by handling the ColumnView.CustomFilterDisplayText event. What I do not know is how I get the text, which the filter editor displays. As I already said on my last post, the filter editor has a little different way to represent the filter criteria. It shows "[Column A] contains xxx" instead of [Column A] Like '%xxx%'. The code for converting a filter to this nice textual representation is already somewhere inside the grid. The only thing I need is to know, how I get this without to create it step by step on my own.
                                 
                                I'm looking forward to your response

                                thanks in advance

                                0

                                Hi Dirk ,

                                Unfortunately, there is no public method to get this information.
                                Generally, a filter is a tree-like structure of conditions grouped with AND/OR operators. The root node in this structure is the FilterControl.FilterCriteria property. I advise that you review the implementation of the CriteriaToTreeProcessor class in DevExpress.Data\Filtering\FilterControlModel.cs (the DevExpress.Data assembly). It will give you an idea on how to process individual conditions of a CriteriaOperator object.

                                DevExpress.Data.Filtering.Helpers.CriteriaToTreeProcessor.GetTree(new DevExpress.XtraEditors.Filtering.FilterControlNodesFactory(), Criteria, null);
                                //where Criteria is DevExpress.Data.Filtering.CriteriaOperator

                                Thanks,
                                Andrew

                                0

                                Hello again

                                I'm gone through some coding and found a solution. At the moment it’s not complete because it’s only showing the first filter criterion but it shows how it works. The next step is to go through the tree-like structure of conditions to get all filters and combine them in sequence with the appropriate brackets

                                private void segoniGridView1_CustomFilterDisplayText(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e)
                                        {
                                            DevExpress.XtraEditors.Filtering.Node newRootNode = DevExpress.XtraEditors.Filtering.CriteriaToTreeProcessor.GetTree(this.segoniGridView1.ActiveFilterCriteria, null);
                                            if (newRootNode != null)
                                            {
                                                FilterControl fs = new FilterControl();
                                                fs.SourceControl = this.segoniGridControl1;
                                                newRootNode.SetOwner(fs, null);
                                                DevExpress.XtraEditors.Filtering.FilterControlLabelInfo li = new DevExpress.XtraEditors.Filtering.FilterControlLabelInfo(newRootNode);
                                                li.CreateLabelInfoTexts(newRootNode);
                                                e.Value = li.Text.Replace("@-","");
                                                e.Handled = true;
                                            }
                                        }

                                Do you have any suggestions to simplify the solution? The most disturbing part for me is that I’m dared to create an instance of FilterControl.

                                Thanks for your assistance

                                ps: in my version 8.2 the CriteriaToTreeProcessor is not in DevExpress.Data but in DevExpress.XtraEditors

                                0

                                Hi Dirk ,

                                Thank you for the feedback.
                                I believe than your approach is fine, and you add and recurse methods to walk though the nodes if the filters criterias.

                                Thanks,
                                Andrew

                                0

                                described solution works fine

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners