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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get all selected records from a table

Thread ID:





130248 May 2,2017 10:54 AM UTC May 3,2017 04:07 PM UTC JavaScript 1
Tags: ejGrid
Daniel Pujante
Asked On May 2, 2017 10:54 AM UTC


I have a table with 200 records with 'allowPaging: true', and added a checkbox column. When I select the header column's checkbox, it is supposed to be selected all records (200).In fact, I can see selected all of them when I change of page. However, when I set 'selectedRecords' as you can see below (I'm using 'Angular'), it just contains the records yor are seeing on the table's page (10 o 11 ) although all the table's records are selected (200).

var datosGrid = angular.element("#gridConsulta").data("ejGrid");

Could you help me about how I could set 'selectedRecords' the all selected records of the table.

Thank you very much


Daniel Pujante

Thavasianand Sankaranarayanan [Syncfusion]
Replied On May 3, 2017 04:07 PM UTC

Hi Daniel, 

Thanks for contacting Syncfusion support. 

Query: Get all the selected rows across all pages. 
We have analyzed your query and we suspect that you want to get all the selected record across all the pages. But in our getSelectedRecords() method, we have only get selected record from the current page this is the behavior of ejGrid. 

We have achieved your requirement using the below work around. So, please refer the below code example. 

<body ng-controller="PhoneListCtrl"> 
    <a rel='nofollow' href="#" ng-click="clik()" title="View the uploaded rate data."> 
    <div class="content-container-fluid"> 
        <div class="row"> 
            <div class="cols-sample-area"> 
                <div id="Grid" ej-grid e-datasource="data" e-allowpaging="true"> 
                    <div e-columns> 
                        <div e-column e-type="checkbox"></div> 
        var obj = [ 
        angular.module('listCtrl', ['ejangular']) 
        .controller('PhoneListCtrl', function ($scope) { 
            $scope.data = obj; 
            $scope.clik = function () { 
                var gridObj = $("#Grid").ejGrid('instance'); 
                var selectedrecordIndex = gridObj.checkSelectedRowsIndexes; //Get the selected row index across all page wise 
                var selectedRecord = []; 
                for (var i = 0; i < selectedrecordIndex.length ; i++) { 
                    if (ej.isNullOrUndefined(selectedrecordIndex[i])) 
                    else { 
                        for (var j = 0; j < selectedrecordIndex[i].length; j++) { 
                            var index = selectedrecordIndex[i][j] + (i * gridObj.model.pageSettings.pageSize);  //Calculate the index for retrieve those data in the data source 
                            selectedRecord.push(gridObj.model.dataSource[index]); // push the selected record from the data source. 

We have prepared a sample in the JsPlayground 

Thavasianand S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon