SelectAll checkbox and paging

Hi,

It seems when you press the 'Select All' checkbox in the header row only those records on the current page will be selected. 

Is there a way to select all the rows in the entire dataset, ie. all pages? Or even better is there an option so the user can choose to slect all on page or all in data set, eg. one click for page, 2 clicks for all data?

thanks

adam toone

1 Reply 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team September 21, 2020 11:33 AM UTC

Hi Adam, 

Greetings from Syncfusion Support. 

Based on your query you need to select all the records in the Grid when you click on the header(selectAll) checkbox. To achieve your requirement we suggest you to enable PersistSelection property of Grid SelectionSettings and any one of the columns must be enabled with IsPrimaryKey as true.  

Please refer the below code snippet for your reference. 
 

var grid = new ej.grids.Grid({ 
        dataSource: window.inventoryData, 
        allowPaging: true, 
        allowSelection: true, 
        selectionSettings: { persistSelection: true }, 
        enableHover: false, 
        columns: [ 
            { type: 'checkbox', width: 50 }, 
            { field: 'Inventor', isPrimaryKey: true, headerText: 'Inventor Name', width: 180 }, 
            { field: 'NumberofPatentFamilies', headerText: 'No of Patent Families', width: 195, textAlign: 'Right' }, 
            { field: 'Country', headerText: 'Country', width: 120 }, 
            { field: 'Active', headerText: 'Active', width: 130 } 
        ], 
        pageSettings: { pageCount: 2 } 
    }); 

Please find the  below sample for more information. 

Sample : https://stackblitz.com/edit/n3n91z-vosdtf?file=index.js

But in Remote data (Syncfusion Adaptors) when we enable paging only the first page records will be fetched from the server-side and binded to the Grid. When we move to the next page then only next page records will be fetched from the server side.  
 
So, when we click on the header checkbox it will select only the current page records. It is the default behavior of an EJ2 Grid.   

Please get back to us if you need further assistance. 

Regards, 
Shalini M. 





Marked as answer
Loader.
Up arrow icon