. . .
button.element.onclick = function () {
var hostUrl = 'https://ej2services.syncfusion.com/production/web-services/';
var newData = new ej.data.DataManager({
url: hostUrl + 'api/Orders',
adaptor: new ej.data.WebApiAdaptor(),
crossDomain: true
});
gridObj.setProperties({ dataSource: newData, pageSettings:{currentPage:1} });
} |
var grid = new ej.grids.Grid({
dataSource: { count: window.orderData.slice(0, 45).length, result: window.orderData.sort(function (x, y) { return x.OrderId >= y.OrderId; }).slice(0, 15) },
allowPaging: true,
actionBegin: function (o) {
console.log(o)
if (o.requestType === 'paging' && !dsSet) {
var hostUrl = 'https://ej2services.syncfusion.com/production/web-services/';
var newData = new ej.data.DataManager({
url: hostUrl + 'api/Orders',
adaptor: new ej.data.WebApiAdaptor(),
crossDomain: true
});
grid.dataSource = newData;
dsSet = true;
}
}
}); |
var dsSet = false;
var button = new ej.buttons.Button({ width: '100px' });
button.appendTo('#primarybtn');
var grid = new ej.grids.Grid({
dataSource: { count: window.orderData.slice(0, 45).length, result: window.orderData.sort(function (x, y) { return x.OrderId >= y.OrderId; }).slice(0, 15) },
allowPaging: true,
actionBegin: function (o) {
debugger
console.log(o)
if (o.requestType === 'paging' && !dsSet) {
this.defaultLocale.EmptyRecord = "";
var hostUrl = 'https://ej2services.syncfusion.com/production/web-services/';
var newData = new ej.data.DataManager({
url: hostUrl + 'api/Orders',
adaptor: new ej.data.WebApiAdaptor(),
crossDomain: true
});
grid.dataSource = newData;
dsSet = true;
}
},
...
});
grid.appendTo('#Grid');
|