Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I'm trying out v11.2.3 beta and would like to test the implementation of S20272 (FilterControl - Add a capability to add filter criteria for involving child objects). How do I go about filtering by a detail column in a GridControl? In my scenario, I have a GridControl bound to a BindingSource which has its DataSource property set to a DataSet and its DataMember property set to a DataTable (Master) with a one to many relationship with another DataTable (Detail).

                                Show all comments
                                • Hi Brandon,

                                  Thank you for your message.

                                  At present this feature does not work for a grid. This behavior is a bug in our controls. Our developers are doing their best to fix this issue with the new 11.2 version release. Please bear with us.

                                  Thanks,
                                  Svetlana

                                • brandon 11.30.2011

                                  Is this resolved in the official 11.2.5 release?

                                • Hi Brandon,

                                  This feature works for a standalone FilterControl. Currently, we are implementing this functionality for the FilterControl embedded to the GridControl. But to do this, it is necessary to write additional code. Therefore, it will take some time.

                                  Now, you can assign the same datasource to GridControl and FilterControl and pass the FilterControl.FilterCriteria value to the GridView.ActiveFilterCriteria property.

                                  I hope this information will be helpful to you.

                                  Thanks,
                                  Gosha

                                • brandon 12.05.2011

                                  Do you have an example project showing how to implement your workaround? Also, can you please open an issue or point me to an existing issue so I can track the progress on implementing the feature for the GridControl's embedded FilterControl?

                                  Thanks,

                                  Brandon

                                • Hi Brandon,

                                  I have found a better solution. You can assign your datasource to the embedded FilterControl in the GridView.FilterEditorCreated event handler. I have created a project that illustrates this approach.

                                  For more information, you can refer to the Filter Control's "filtering by child objects" features do not work in XtraGrid bug report that describes this bug.

                                  Thanks,
                                  Gosha

                                • brandon 12.06.2011

                                  I applied your new solution to my project and couldn't get it to work because e.FilterControl was null. I then realized I used gridView1.OptionsFilter.DefaultFilterEditorView = FilterEditorViewMode.VisualAndText while you used the default value of FilterEditorViewMode.Visual. Apparently, e.FilterControl can only be used in the FilterEditorCreated event if the OptionsFilter.DefaultFilterEditorView = FilterEditorViewMode.Visual. If Text, TextAndVisual, or VisualAndText is used, e.FilterControl is null. Is this intended or a bug? I'd really like to be able to use VisualAndText and still use your workaround. Please see the attached sample project.

                                  Thanks,

                                  Brandon

                                • brandon 12.06.2011

                                  I have another issue in addition to my previous post. I get a DevExpress.Data.Filtering.Exceptions.InvalidPropertyPathException if I set a Child Filter and then change the GridControl's DataSource. What should I do to avoid the exception? Please see the attached project and video.

                                  Thanks,

                                  Brandon

                                • Hi Brandon,

                                  Regarding your first question. In this case, you can use the e.IFilterControl parameter instead of the e.FilterControl one. When OptionsFilter.DefaultFilterEditorView has a value different from FilterEditorViewMode.Visual, the IFilterControl parameter is FilterEditorControl, so you can utilize the approach described above.

                                  Regarding your second question.The required feature is not implemented in GridControl. This problem should disappear as soon as we fix the Filter Control's "filtering by child objects" features do not work in XtraGrid bug. Currently you can reset the GridView.ActiveFilterCriteria property to null before reassigning the datasource.

                                  I have modified your project to illustrate both these approaches.

                                  Thanks,
                                  Gosha

                                • brandon 12.07.2011

                                  I have another issue. If I use a RepositoryItem in the GridControl and set the FilterControl's SourceControl property in the FilterEditorCreated event as done in your sample project, the RepositoryItem is not used by the FilterControl. How can I can take advantage of the child filtering and retain the RepositoryItem set in the GridControl? Please see the attached project and video.

                                  Thanks,

                                  Brandon

                                • Hi Brandon,

                                  To achieve this goal, you can iterate through all filter columns of the filter editor and set required repository items from grid columns using Reflection. I have modified your project to illustrate this way.

                                  Thanks,
                                  Gosha

                                • brandon 12.08.2011

                                  Unbound columns do not appear in the filter editor when using your approach. How do I include the unbound columns in the filter editor? Please see the attached project.

                                  Thanks Again,

                                  Brandon

                                • Hi Brandon,

                                  I have modified your project to take into account unbound columns.

                                  Thanks,
                                  Gosha

                                • brandon 12.12.2011

                                  I have some more issues:

                                  1. You've shown how I can get a repository item from the main view to be used in the filter control. How do I get a repository item from a detail view to show up in the filter control? Please see in the attached project where I assigned a RepositoryItemLookUpEdit to the ProductID column in the Order_Details Child/Detail GridView.

                                  2. I've found that if there are multiple detail view relationships to select from in the filter control and the selected detail view relationship is changed to another detail view relationship in the filter control, the detail column list that remains is that of the originally selected detail view relationship. I would have expected the list to reflect the newly selected detail relationship. How do I make the detail column list stay in sync with the selected detail relationship? Please see the attached project where I added a new detail view for Order Notes.

                                  3. I noticed that the performance of the detail/child filtering is poor when there are a lot of records. For example, in the attached project, I added 1000 records to the main view (Orders) and 10,000 to the detail view (Order_Details) and it took 10 seconds to apply a child filter. Is there anything that can be done to improve the child filtering performance?

                                  Please see the attached video in addition to the project.

                                  Thanks,

                                  Brandon

                                • Hi Brandon,

                                  Thank you for your feedback.

                                  I should say that there is no common solution to the problem that occurs when filtering data via FilterControl when a datasource has relations. Our XtraGrid allows customizing the number of relations and detail view settings for an individual row. However, FilterControl should display the same columns and editors for all the rows. Thus, it is impossible to define how many relations should be taken into account, and what views should be assigned to these relations.

                                  I suggest you populate filter columns with required columns manually by utilizing the same approach as the one demonstrated in my projects.

                                  Regarding the filtering performance. In fact, your datasource contains a great number of records. For each parent record it is necessary to obtain its child records and compare the obtained records with applied filter criteria. It takes some time. Currently I cannot provide you with any solution to improve the performance, but we are constantly improving our algorithms.

                                  Thanks,
                                  Gosha

                                • brandon 12.13.2011

                                  Will you please provide an example on how to resolve issue number 1 from my previous post? I don't know how I get to the collection of detail filter columns.

                                  The second issue from my previous post just points out a bug. If I choose to filter by a detail column by selecting a detail relationship and then change the selected value to a non detail relationship, the detail column list is cleared as expected. However, if the selected value is changed to another detail relationship, the detail column list remains the same instead of being removed and replaced with the appropriate detail column list. Please see the attached video.

                                  Another bug I've come across has to do with the operator of a detail filter expression. If I appy a filter based on a detail column, close the filter control, re-open the filter control, and attempt to change the operator on the detail filter expression, I am unable to do so because the operator lookup is empty. Please see the attached video.

                                  In regard to issue 3 from my previous post, if I am stuck with a slow filtering experience, how can I at least show a busy signal to the user? I don't see any Filtering or Filter Completed events.

                                  Also, how do I make this thread public? The Private checkbox is grayed out. I originally set it to private because I was part of the private beta at the time.

                                • Uriah (DevExpress Support) 12.14.2011

                                  Hi Brandon,

                                  >> Will you please provide an example on how to resolve issue number 1 from my previous post? I don't know how I get to the collection of detail filter columns.

                                  We have researched this task further and found another solution that seems to be a bit simpler, even though it requires creating a GridControl descendant. I have modified the sample project to demonstrate the new approach. Please check how the project operates and let us know whether or not this solution meets your requirements.

                                  >> The second issue from my previous post just points out a bug. If I choose to filter by a detail column by selecting a detail relationship and then change the selected value to a non detail relationship, the detail column list is cleared as expected. However, if the selected value is changed to another detail relationship, the detail column list remains the same instead of being removed and replaced with the appropriate detail column list. Please see the attached video.

                                  Thank you for pointing our attention to this issue. I have registered a new bug report on your behalf: FilterControl - A child columns list available for an aggregate expression is not synchronized with a parent column.

                                  >> Another bug I've come across has to do with the operator of a detail filter expression. If I appy a filter based on a detail column, close the filter control, re-open the filter control, and attempt to change the operator on the detail filter expression, I am unable to do so because the operator lookup is empty. Please see the attached video.

                                  I have registered another bug on your behalf at: FilterControl - Cannot change the clause operator.

                                  >> In regard to issue 3 from my previous post, if I am stuck with a slow filtering experience, how can I at least show a busy signal to the user? I don't see any Filtering or Filter Completed events.

                                  I am afraid that this issue is specific to the DataView, which instantiates a new DataView instance each time detail data is requested for a master row. To see the problem, execute the code I posted below on your side. You will see that its execution takes 15 seconds with your data on my laptop.

                                  [C#]
                                  PropertyDescriptor prop = ordersBindingSource.GetItemProperties(null).Find("OrdersOrder Details", false); object value; foreach (object item in ordersBindingSource) value = prop.GetValue(item);

                                  I suggest that you test any object-based datasource; for example, LINQ to SQL. I believe it should not have this problem.

                                  >> Also, how do I make this thread public? The Private checkbox is grayed out. I originally set it to private because I was part of the private beta at the time.

                                  I have made this thread public, as you requested.

                                  Thanks,
                                  Uriah

                                • brandon 12.15.2011

                                  In the sample projects, there is an Order Notes detail table, which is selectable in the FilterControl in Gosha's sample project, but not Uriah's. To force the Order Notes to appear, I found that I needed to define a detail GridView for Order Notes, which I would not have expected to do since the GridControl's ShowOnlyPredefinedDetails property = False. Is this by design or an oversight?

                                  Also, I found that if I programmatically create the Order Notes GridView and don't execute the PopulateColumns method on it, the child column list that appears when selecting Order Notes in the FilterControl is that of the main view, Orders, instead of the child view, Order Notes.

                                  Lastly, I haven't had a chance to do any testing with any object based datasources as suggested. However, my project does use DataSets, and so is there anything I can do to improve the user experience for slow filters? I'd like to at least implement a busy signal. Are there any pre-filter and post filter events that I can utilize?

                                  Thanks for your help,

                                  Brandon

                                • Uriah (DevExpress Support) 12.19.2011

                                  Hi Brandon,

                                  GridControl does not populate the LevelTree at runtime. If the ShowOnlyPredefinedDetails option is disabled, GridControl creates detail levels on demand. It is necessary to create all required detail levels before the filter dialog is shown, because the only easy way to support filtering by detail data in the GridView via FilterControl is to populate the FilterControl with filter columns based on existing GridView columns.

                                  There is no easy way to make the FilterControl to properly cooperate with the GridView if its filter columns are not based on GridView columns. I am afraid that we do not have opportunity to research this approach further, because we are limited in resources.

                                  The GridView does not raise event before sorting is applied. To track this, you need to create the custom filter builder, and override its ApplyFilter method. Please review the How to implement your own Filter Builder dialog for the GridView example for details.

                                  Thanks,
                                  Uriah

                                • brandon 12.27.2011

                                  In the sample project from 12-15-2011, a red x appears in place of the filter control when using the Count, Max, or Min operators on a child expression. Please see the attached video for the steps to reproduce.

                                • Uriah (DevExpress Support) 12.28.2011

                                  Hi Brandon,

                                  Please modify the DetailFilterColumn class as shown below, to resolve this problem:

                                  [C#]
                                  class DetailFilterColumn :UnboundFilterColumn { public DetailFilterColumn(string fieldName, ColumnView view) : base(fieldName, fieldName, typeof(IList), GetDetailFilterColumnEditor(view), FilterColumnClauseClass.Generic) { fChildren = new List<IBoundProperty>(); using (CustomViewFilterColumnCollection nested = new CustomViewFilterColumnCollection(view)) { for (int i = nested.Count - 1; i >= 0; i--) { FilterColumn col = nested[i]; col.SetParent(this); fChildren.Add(col); nested.Remove(col); } } } static RepositoryItem GetDetailFilterColumnEditor(BaseView view) { string editorName = "DetailFilterColumnEditor"; RepositoryItem result = view.GridControl.RepositoryItems[editorName]; if (result == null) result = view.GridControl.RepositoryItems.Add("TextEdit"); result.Name = editorName; return result; }

                                  Thanks,
                                  Uriah

                                • brandon 01.05.2012

                                  I noticed the filter does not assign default repository items for detail columns. In the attached project I added a date field to the Order Notes detail grid and set the value for each row to the current date. Because a RepositoryItemDateEdit is not assigned, I have to type in the date when filtering. If I just use the date part (i.e., 1/5/2011), no results are returned. Alternatively, I get results if I use the "greater than" operator or type out the full date and time (i.e., 1/5/2011 12:00:00 AM). If I manually assign a RepositoryItemDateEdit to the date field, then I get the calendar control and can just select or enter the date part (i.e., 1/5/2011). Is this by design or a bug? I expected detail columns to use the default repository item when one is not manually assigned.

                                  Please see the attached project and video. Note that the attached project uses 11.2.7 and implements both the custom filter builder and the fix for the red x.

                                  Thanks,

                                  Brandon

                                • Uriah (DevExpress Support) 01.06.2012

                                  Hi Brandon,

                                  This is a technical limitation. Filter columns are created based on the pattern view that is not bound to the data. Therefore, the column type cannot be resolved, and the default editor is the TextEdit. It is necessary to assign editors to detail view columns manually, in order to resolve this problem.

                                  Thanks,
                                  Uriah

                                • rtabit 07.09.2012

                                  Hi has this been fixed yet or could you modify bandon's solution to use EF V1 (.NET 3.5)? Thanks.

                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                This feature already implemented in XtraGrid. Please see the Filter Control's "filtering by child objects" features do not work in XtraGrid thread for details.

                                You must  log in  or  register  to leave comments

                                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