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

Server side sorting doesn't render as expeceted

0 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patric Svensson
Top achievements
Rank 1
Patric Svensson asked on 13 Feb 2013, 02:54 PM
Edit: Thought this was a ticket but realized I was wrong and have now added a support ticket for this issue.

Hi, 

We have a grid that we would like to populate with server side sorted information. So what we did was this:
@(Html.Kendo().Grid<MyProject.ViewModels.Calculation.WorkGridItem>()
      .Name("grid")
      .BindTo(Model.WorkGrid.WorkGridItems)
      .Columns(c =>
                   {
                       c.Bound(i => i.Identifier).Title("Id");
                       c.Bound(i => i.Name).Title("Namn");
                       c.Bound(i => i.City).Title("Stad");
 
                       c.Bound(i => i.Status).Title("Status");
                       c.Bound(i => i.StartDate).Title("Start");
                       c.Bound(i => i.EndDate).Title("Slut");
                       c.Bound(i => i.Created).Title("Skapad");
                       c.Bound(i => i.SigningDate).Title("Signatur");
                   })
            .ClientDetailTemplateId("expandedRowTemplate")
            .Events(l => l.DetailInit("OnLoadDetail"))
            .Events(ev => ev.DetailExpand("detailExpand"))
            .Pageable(x =>
                    {
                        x.PageSizes(new int[] { 50, 100, 200 });
                        x.Refresh(true);
                    })
        .Sortable(x => x.Enabled(true))
        .DataSource(ds => ds.
                            Ajax()
                            .ServerOperation(true)
                            .Read(read => read
                                              .Action("ReadGridItems", "Calculations",
                                                      new
                                                          {
                                                              selectedTab = Model.Tabs.SelectedTab().Value,
                                                              gridType = Model.PageHeaderSearch.SelectedSearchType,
                                                              searchString = Model.PageHeaderSearch.SearchWord,
                                                               
                                                          })
                                              .Type(HttpVerbs.Post)
                            )
                            .PageSize(50)
We then sort the data, and returns the data source and I can see it being sorted the way I want it to. However, when the data is redered in the grid it is all messed up. 

When sorting desc on one of the columns, the date would look like this:

28.02.2013
28.02.2013
28.02.2013
28.02.2013
28.02.2013
26.02.2013
25.03.2013
25.02.2014
25.02.2013


Why is this? By setting ServerOperation to true, whould that not then let me do the sorting on the server side and then let me just render the data? 

Any thought on this?


No answers yet. Maybe you can help?

Tags
Grid
Asked by
Patric Svensson
Top achievements
Rank 1
Share this question
or