This is a migrated thread and some comments may be shown as answers.

[Solved] MVC Grid Paging Not Working With Ajax DataSource

1 Answer 388 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rehan
Top achievements
Rank 1
Rehan asked on 24 Sep 2014, 03:10 PM
I have the following code:

Controller Action
[HttpPost, Route("json", Name = "GetIndexJson")]
public ActionResult Index([DataSourceRequest]DataSourceRequest request)
{
    IQueryable<IncidentIndexViewModel> incidents = this.databast.Incidents
        .Select(i =>
            new IncidentIndexViewModel()
            {
                Name = i.Name,
            });
 
    DataSourceResult result = incidents.ToDataSourceResult(request);
    return this.Json(result, JsonRequestBehavior.AllowGet);
}


View
@(Html.Kendo()
    .Grid<IncidentIndexViewModel>()
    .Name("grid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(14)
        .Read(read => read.Route("GetIndexJson").Type(HttpVerbs.Post))
        .ServerOperation(true))
    .Columns(
        columns =>
        {
            columns.Bound(x => x.Name).Width(70);
        })
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .Sortable(x => x.SortMode(GridSortMode.MultipleColumn))
    .Filterable()
    .Groupable()
    .Navigatable()
    .Selectable(x => x.Mode(GridSelectionMode.Single))
    .Pageable(x => x.Enabled(true).Refresh(true))
    .Scrollable(x => x.Height(423)))

However, the paging on the grid does not work. The page is stuck on page zero but has the next page button enabled. When I click the next page button I get the following JavaScript error:

Unhandled exception at line 89, column 3956 in http://localhost/bundles/kendo
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'slice'

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 26 Sep 2014, 08:59 AM
Hello Rehan,

Can you demonstrate this behavior in a runnable example? We will need on in order to debug it locally and assist you further.

You also go through the steps in the following article - Grid Ajax Binding, and see whether your setup follows them.

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Rehan
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or