We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to stop auto select of Select all option on filtering

Hi team, as per the default behavior of the Grid filter of type checkbox, once we search for something in the filter box, it will select the Select All option by default.

But, I want to prevent it and give the user flexibility to select after filtering. Please let me know how can I do the same.

Also how to Remove the option - "Add current selection to filter"?

Waiting for a quick solution.





Thanks


6 Replies

AD Animesh Dutta April 24, 2023 06:42 AM UTC

Team, waiting for your response. 

Please have a look.



RR Rajapandi Ravi Syncfusion Team April 27, 2023 11:35 AM UTC

Animesh,


By default when we type something in the search box of filter dialog, since the searched values are in checked state so that the Select All also checked. It was the default behavior.


We have removed the “Add current selection to filter” option by using the actionComplete event of Grid. Please refer the below code example and sample for more information.


 

function actionComplete(args) { //actionComplete event of Grid

        if(args.requestType === 'filterchoicerequest') {

            args.filterModel.dlg.querySelector('.e-checkboxlist').children[1].remove();

        }

    }

 


Sample: https://stackblitz.com/edit/react-qwqbas?file=index.js



AD Animesh Dutta April 28, 2023 05:25 AM UTC

Thanks for the response.

But can we make the searched values in the unchecked state by default? 

How this can be achieved?



Thanks



RR Rajapandi Ravi Syncfusion Team May 1, 2023 07:17 AM UTC

Animesh,


You can achieve your requirement by programmatically click the selectAll checkbox in the actionComplete event of Grid. Please refer the below code example and sample for more information.


function actionComplete(args) { //actionComplete event of Grid

        if(args.requestType === 'filterchoicerequest' && args.filterModel.dlg.querySelector('.e-searchinput').value.length > 0) {

            args.filterModel.dlg.querySelector('.e-checkboxlist').children[1].remove();

            args.filterModel.dlg.querySelector('.e-checkboxlist').children[0].querySelector('input').click();

        }

    }


Sample: https://stackblitz.com/edit/react-qwqbas-ckn17h?file=index.js



AD Animesh Dutta May 9, 2023 07:26 AM UTC

Thanks it's working fine.



RR Rajapandi Ravi Syncfusion Team May 10, 2023 04:13 AM UTC

Animesh,


We are glad to hear that our provided solution was working fine at your end.


Please get back us if you need any further assistance.


Loader.
Live Chat Icon For mobile
Up arrow icon