Wednesday, 7 August 2013

Need Solution To implement server side sorting in kendo grid

Need Solution To implement server side sorting in kendo grid

I am trying to implement server side sorting with kendo grid in my MVC
application. but sorting option is not showing. i have double checked that
i have enabled all the necessary option (made the serversorting to true to
the the kendo grid data source and made the scrollable to true to the grid
element) to do this but still i am able to find the sortable option. below
is my kendo grid code
Kendo Grid Script
var grid = $("#grid");
grid.children().remove();
grid.kendoGrid({
columns:
[{attributes:"",field:"",template:"${ResultFields[0].Value},title:"Column
1",width:"110px"},{attributes:"",field:"",template:"${ResultFields[1].Value},title:"Column
1",width:"110px"}],
resizable: true,
reorderable: true,
scrollable: true,
filterable: true,
columnMenu: true,
selectable: "row",
selectable: "multiple",
dataBound: function () { alert("Data Bound"); },
dataSource: {
transport: {
read: {
url: '@Url.Action("Index", "KendoServerSideSorting")',
type: "GET",
dataType: "json",
traditional: true,
data: {
itemTypeId: 1,
where: values,
orderBy: ["", "", ""],
},
},
},
schema: {
data: "Items",
total: "TotalItems",
},
serverPaging: true,
pageSize: 10,
error: function (e) {
alert(e.errors);
}
},
pageable: {
pageSize: 10,
input: true,
pageSizes: [10, 20, 30, 50, 100, 250],
},
change: function () { alert("Change event"); },
})
Controller Action will look like this
public JsonResult Search(int itemTypeId, int skip, int take, string[]
where, string[] orderBy)
{
var v = Kernel.Get<IItemSearch>().Search(itemTypeId, skip, take,
where, orderBy);
return Json(v, JsonRequestBehavior.AllowGet);
}
*Can anyone help me to resolve this issue. *

No comments:

Post a Comment