Control A to select all records from Multiple Page of Syncfusion GRid

Control A to select all records from Multiple Page of Syncfusion Grid. Right now it only selects records from same page not from all the pages. My requirement is to perfrom select all using control A needs to select all records form all pages. Say if we have 5 pages of data.


Image_3879_1708667919477


1 Reply

RR Rajapandi Ravi Syncfusion Team February 26, 2024 10:36 AM UTC

Hi Viji,


Greetings from Syncfusion support


After reviewing your query, we could see that while clicking CTRL + A you like to select all records in the Grid with multiple pages. To achieve your requirement, you can implement custom keyboard shortcuts to execute specific actions. To achieve this, you can utilize the keyPressed event of the grid. This event is triggered for every key press, allowing you to customize the behavior based on the pressed key. Please refer the below code example, sample and documentation for more information.


In this below sample, we have defined the checkbox column and invoke the checkSelectAll() method to perform and maintain the selection in all pages.


 

keyPressed(e: any) {

        const key = e.key.toLowerCase();

        switch (key) {

            case 'a':

                if (e.ctrlKey) {

                    e.preventDefault();

                    this.grid.selectionModule.checkSelectAll();

                }

                break;

            // Add more custom shortcuts as needed

        }

    }

 


Sample: https://stackblitz.com/edit/angular-gknmqh-zrjo8p?file=src%2Fapp.component.ts,src%2Fapp.component.html


Documentation: https://ej2.syncfusion.com/angular/documentation/grid/accessibility#custom-shortcut-keys-to-perform-grid-actions


API: https://ej2.syncfusion.com/angular/documentation/api/grid/#keypressed


Regards,

Rajapandi R


Loader.
Up arrow icon