Hi Team,
am using Kendo UI grid and I have a scenario where I need to set server sorting to true if I get the total number of records >= 1000, if the number of records are less than 1000 , then the server soring should set to false. I also have dynamic columns and headers. Here is the rough code.
If I get more than "1000" records then server sorting is set to true but it triggers the read operation again continuously? Could you please help with this scenario, please let me know if am missing anything here.
this.bindWidgetData = function () {
$("#" + gridId+ "").empty();
$("#" + widgetId + "").kendoGrid({
sortable: {allowUnsort:true},
selectable: "Single, Cell",
resizable: true,
pageable: false,
dataBound:this.dataBound,
change: function (e) {
var i = 10;
}
//dataBinding: this.dataBinding,
})
setGridData();
}
this.setGridData = function () {
var gridData = $("#" + this.gridid).data("kendoGrid");
_widgetCallParams = this.getCallParameters();
this.UpdateSortInfo(sort);
var dataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
$.ajax({
url: getBaseURL() + "WSIHome/GetCustomListData",
dataType: "json", // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
data: _widgetCallParams,
type: "POST",
success: function (result) {
var columns = _this.getGridColumnsHeadersandFormat(result.data);
gridData.setOptions({
columns: columns
});
gridData.dataSource.options.serverSorting = (result.rowtotal) >= _widgetCallParams.TopX ? true : false;
options.success(result);
},
schema: {
data: "data",
total: "rowtotal"// twitter's response is { "results": [ /* results */ ] }
},
});
gridData.setDataSource(dataSource);
};