Su C
Su C

Reputation: 13

KendoUI Grid: How to select all pages data

I am trying to select data from a kendo grid. I need to select one cell at a time when user clicks one key element in that row. I am successful in getting each row's data from first page but when I go to the next page the same function does not work anymore. Do I have to add code in change function ie., in grid change? Here's the code:

       $('.data').click(function () {
       alert($(this).text());
       var grid = $("#List").data("kendoGrid");
       var selectedItem = grid.dataItem(this.parentElement.parentElement);
       CData.set('activedata', selectedItem);
        }

I understand data source gets all the data but this doesn't work:

             $('.data').click(function () {
              alert($(this).text());
              var grid = $("#List").data("kendoGrid");
              var selectedItem = grid.dataItem(this.parentElement.parentElement);
             CData.set('activedata', selectedItem);
              }

              for (var i = 0; i < datasourcedata.length; i++) {
                var currentitem = datasourcedata[i].CompanyID;
                if (currentitem == $('.data')) {
                    selectedItem = grid.dataItem(this.parentElement.parentElement);
                    alert($(selectedItem));
                    Comp.set('activeCompany', selectedItem);
                }
            }

Where am I wrong? Any help appreciated.

Upvotes: 0

Views: 3280

Answers (3)

Sachin Panchal
Sachin Panchal

Reputation: 169

This will help you for printing all pages in kendo grid

var dataSource = $("#grid").data("kendoGrid").dataSource;
dataSource.pageSize(dataSource.total());

Upvotes: 3

Burhan Kaya
Burhan Kaya

Reputation: 139

I change datasource settings.

serverPaging: false, serverFiltering: false,
serverSorting: false

solved in this way.

Upvotes: 1

layonez
layonez

Reputation: 1785

I think you don't need to use jquery events but instead use some kendo approach with change event. That way you always can change selectedDataItems collection based on users actions.

Upvotes: -1

Related Questions