My code is given below
VIEW:-
@model IEnumerable<SampleKendo.Models.TestModel>
@using Kendo.Mvc.UI
@using Kendo.Mvc.UI.Fluent
@using SampleKendo.Models
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false);
columns.Bound(p => p.Name);
columns.Bound(p => p.Age);
})
.Pageable()
.Scrollable()
.Filterable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read=>read.Action("GetDepartment","Test")))
)
Controller:_
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using SampleKendo.Models;
using System.Web.Mvc;
namespace SampleKendo.Controllers
{
public class TestController : Controller
{
//
// GET: /Test/
public ActionResult Index()
{
return View(GetDepartmentData());
}
public ActionResult GetDepartment([DataSourceRequest] DataSourceRequest request)
{
return Json(GetDepartmentData().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
private static IEnumerable<TestModel> GetDepartmentData()
{
var db = new DBPULSEEntities();
return db.DEPARTMENTs.Select(c =>
new TestModel
{
Id = c.Id,
Age = c.Age,
Name = c.Name,
Birthday = c.Birthday
});
}
}
}
I have set the ServerOperation() to false.. but still its not working
When i try to sort, or filter the result is per given in the pic
VIEW:-
@model IEnumerable<SampleKendo.Models.TestModel>
@using Kendo.Mvc.UI
@using Kendo.Mvc.UI.Fluent
@using SampleKendo.Models
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false);
columns.Bound(p => p.Name);
columns.Bound(p => p.Age);
})
.Pageable()
.Scrollable()
.Filterable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read=>read.Action("GetDepartment","Test")))
)
Controller:_
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using SampleKendo.Models;
using System.Web.Mvc;
namespace SampleKendo.Controllers
{
public class TestController : Controller
{
//
// GET: /Test/
public ActionResult Index()
{
return View(GetDepartmentData());
}
public ActionResult GetDepartment([DataSourceRequest] DataSourceRequest request)
{
return Json(GetDepartmentData().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
private static IEnumerable<TestModel> GetDepartmentData()
{
var db = new DBPULSEEntities();
return db.DEPARTMENTs.Select(c =>
new TestModel
{
Id = c.Id,
Age = c.Age,
Name = c.Name,
Birthday = c.Birthday
});
}
}
}
When i try to sort, or filter the result is per given in the pic