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

Sorting not working

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gheorghe
Top achievements
Rank 1
Gheorghe asked on 07 Jan 2014, 01:54 PM
Hello my sorting is not working at all, no matter what I do. If I look in firebug the json-encoded response shows up but it is not sorted correctly, if I put a breakpoint in the "Get" method the request.Sorts parameter is null. It shows the arrows inside the columns but nothing else happens.

here is the code for the view

@(Html.Kendo().Grid<ModelNewsletter>().Name("NewslettersGrid").Columns(c => {
    c.Bound(m => m.Title);
    c.Bound(m => m.DateCreated).Format("{0:dd/MM/yyyy}");
    c.Bound(m => m.AccommodationName);
}).DataSource( d => d
    .Ajax()
    .Read(r => r.Action("Get", "Newsletter"))
    .PageSize(5)
)
.Pageable()
.Sortable(sb => sb.AllowUnsort(true).SortMode(GridSortMode.SingleColumn))
.ToolBar(toolbar => toolbar.Custom().Action("Create", "Newsletter").Text("Create"))
)

And here is the controller action that gets called

[HttpGet]
public JsonResult Get([DataSourceRequest]DataSourceRequest request) {
    uow.SetContextProxyCreation(false);
    var newsletters = uow.NewslettersRepository.GetNewslettersByCompanyForGrid(SessionHandler.User.IDCompany);
    var ds = newsletters.ToDataSourceResult(request);
    return this.Json(ds, "text/x-json", JsonRequestBehavior.AllowGet);
}

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 08 Jan 2014, 07:32 AM
Hello Gheorghe,

We are not sure what might cause this behavior. All your setup looks correct. One thing you can check is whether all required scripts are included in correct order.

Step 5 in the following article shows what scripts are required and the correct order in which they must be included.

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
Gheorghe
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or