Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Filtering Child records in Hierarchical data
posted

Hi All, 

We have a Xamdatagrid which is displaying hierarchical data with plus(+) symbol. It has 4 - 5 levels child data and these data levels will be decided at runtime. The data source collection has the same object for Parent and Child. 

We have enabled the record filtering and could see only the top level records are available in the filer dropdown to execute the filter. As per the requirement, the filter should work for parent and child level records. If filter satisfies only the child, then grid should display the child alone. 

Having above mentioned scenario in place, here are the challenges that we are facing at this point, 

1. Since the fields are same for all hierarchical data , we need to populate all the unique values in the filter dropdown. 

2. When end user selects the value from the filter dropdown, the grid should display all the records including child. If child alone meets the criteria, grid should display the only child. 

I have tried to achieve the above with help of the following events. But no luck.  

  1. RecordFilterChanging

  2. FilterdropdownOpening

 It would be great if somebody gives sample code / approach for  the above mentioned issues.

 Thanks in advance !

Parents
  • 34430
    Offline posted

    Hello Krishnan,

    Regarding your first question, I would recommend using the RecordFilterDropDownPopulating event. This event will fire once for each time that a new filter drop down is opened. Using this event, you can check if a field has a certain Name, and if it does, you can loop through your data and add a new FilterDropDownItem for each data item in your data that matches that field name. After the loop, be sure to set e.IncludeUniqueValues to false in case you have multiples of the same value. Below is a link to our online documentation about how to achieve this.

    http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v13.2~Infragistics.Windows.DataPresenter.DataPresenterBase~RecordFilterDropDownPopulating_EV.html

    Regarding your second question, I feel that your best option to do this would be to handle the RecordFilterChanged event. You will also need to have a collection that holds all of your data that you can modify based on what filter is chosen, because the only way you will be able to get a child row to become a parent row would be to set the DataSource on your XamDataGrid to a new collection. Below is a link to another forum thread on how to get the currently selected filter value.

    Filter Value Forum Thread: http://www.infragistics.com/community/forums/t/61519.aspx

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Developer Support Engineer I
    Infragistics Inc.
    www.infragistics.com/support

Reply Children