Filtering not filtering parent


I want to filter both parent and child, when I try to filter parent then its need to show all its child for example if I search for tortillas ​in the above image then its need to show both matching child and matching parent along with its child. Can you help to to achieve this ?

2)And also  I want to select only parent with out selecting its child in multiselect.


1 Reply

DR Deepak Ramakrishnan Syncfusion Team July 15, 2021 02:08 PM UTC

  
Hi Ashok, 
 
Thanks for contacting Syncfusion Support.  
 
Query 1:  I want to filter both parent and child, when I try to filter parent then its need to show all its child for example if I search for tortillas ​in the above image then its need to show both matching child and matching parent along with its child. Can you help to achieve this ? 
 
 Yes we can achieve this scenario  by using the  ‘Predicate’ of dataManager to filter items based on multiple fields in filtering event of MultiSelect as shown below ,



 
public onFiltering: EmitType<FilteringEventArgs> = ( 
    e: FilteringEventArgs 
  ) => { 
    let predicate = new Predicate('Vegetable', 'startswith', e.text, true); 
    predicate = predicate.or('Category', 'startswith', e.text, true); 
    let query: Query = new Query(); 
    //frame the query based on search string with filter type. 
    query = e.text !== '' ? query.where(predicate) : query; 
    e.updateData(this.vegetables, query); 
  }; 
 
 
Query 2: And also  I want to select only parent without selecting its child in multiselect. 
 
Currently the requested requirement is not supported in Multiselect Checkbox component. But this can achieved using the Dropdown Tree Checkbox component. Please find the demo and documentation below for reference.   
 
Demo                    https://ej2.syncfusion.com/angular/demos/#/material/drop-down-tree/checkbox    
API                       https://ej2.syncfusion.com/angular/documentation/api/drop-down-tree/    
 
Kindly check the above suggested component meets your requirement and if you need further assistance please get back to us.


Thanks,
 
Deepak Ramakrishnan. 


Loader.
Up arrow icon