Sort the filtering options

I want to sort the Filtering options like when ever user opens the filter dialog then selected filter needs to come first remaining later .

In the above screenshot I want 050249471 and 050249496 need to be on top after select all

https://stackblitz.com/edit/angular-ivy-wi5ccj?file=package.json

1 Reply 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team June 18, 2021 12:30 PM UTC

Hi Ashok,  
  
Thanks for contacting Syncfusion support. 
 
Query: I want to sort the Filtering options like when ever user opens the filter dialog then selected filter needs to come first remaining later  
 
Based on your requirement, you want to show the checked (filtered) value always top in the CheckBox Filter popup. You can achieve your requirement by using the following code example in the actionComplete (requestType as filterchoicerequest) event of Grid.  
 
 
 
[app.component.ts] 
 
 
  actionComplete(args){ 
    if(args.requestType == "filterchoicerequest"){ 
      if(args.filterModel.isFiltered > 0){ 
      // get all the checklist in the popup 
      var filterlists = args.filterModel.dlg.querySelector('.e-checkboxlist'); 
      forvar i=0i<filterlists.children.lengthi++){ 
        if(filterlists.children[i].getElementsByClassName('e-check').length > 0){ 
          // move the checked item to the top 
          filterlists.insertBefore(filterlists.children[i],filterlists.children[1]); 
        } 
      } 
      } 
    } 
  } 
 
 
 
We have prepared a sample for your reference. You can get it from the below link, 
 
 
Please get back to us if you need further assistance with this. 
 
Regards, 
Rajapandiyan S 


Marked as answer
Loader.
Up arrow icon