I have tables on my server with thousands of records and im using ember framework(ember data). for my grid i want to pass only an array of 2500 in total and as the user scrolls server side paging happens and the response update my datasource array but i dont know how. here is what i have sofar:
import Ember from 'ember';
export default Ember.Component.extend({
className: 'kendo-grid',
kendoGrid: null,
initGrid: function () {
this.send('createGrid');
}.on('didInsertElement'),
dataSourceObserver: function () {
this.send('recreateGrid');
}.observes('gridObject'),
actions: {
recreateGrid: function () {
//Every time we recreate the grid, we need to destroy it first and create it again
this.get('kendoGrid').wrapper.empty();
this.get('kendoGrid').destroy();
this.send('createGrid');
},
createGrid: function () {
var gridModelData = this.get('gridObject.source');
var gridHeight = this.get('gridObject.height');
var gridPageSize = this.get('gridObject.pageSize');
var dataSource = {
data: gridModelData,
serverPaging: true,
serverSorting: true,
pageSize: 20,
};
var grid = Ember.$("#kendo-grid").kendoGrid({
dataSource: dataSource,
pageSize: gridPageSize,
pageable: {
refresh: true, //if set to true, it will show refresh button,clicking on that will make the grid to refresh
numeric: false,
previousNext: false,
messages: {
display: "Loaded {0}-{1} from {2} data items"
},
},
height: gridHeight,
groupable: true,
sortable: {
mode: "multiple"
},
filterable: true,
scrollable: {
virtual: true,
},
}).data('kendoGrid');
this.set('kendoGrid', grid);
var pager = grid.pager;
var test_pagechange = function (e) {
console.log(e);
};
pager.bind('change', test_pagechange);
}
}
});
i dont want to use url in my grid datasource.