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

Sorting of Group column at client side

1 Answer 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amol
Top achievements
Rank 1
Amol asked on 10 May 2013, 12:27 PM
Hello we have one grid with group by column as in below code.
 
 @(Html.Kendo().Grid<Xyz>()
     .Name("OwnerGrid")
     .Columns(columns =>
     {
                columns.Bound(p => p.OwnerName).Hidden().ClientGroupHeaderTemplate("#= value #").HeaderHtmlAttributes(new { style = "text-align:left;" }).HtmlAttributes(new { style = "text-align:left;" });      
        columns.Bound(p => p.ShortDescription).Width("20%").HeaderHtmlAttributes(new { style = "text-align:left;" }).HtmlAttributes(new { style = "text-align:left;" });
         columns.Bound(p => p.Description).Width("30%").HeaderHtmlAttributes(new { style = "text-align:left;" }).HtmlAttributes(new { style = "text-align:left;" });
         columns.Bound(p => p.Status).Width("15%").HeaderHtmlAttributes(new { style = "text-align:left;" }).HtmlAttributes(new { style = "text-align:left;" });
         columns.Bound(p => p.Date).Width("10%").Format("{0:MM/dd/yyyy}").HeaderHtmlAttributes(new { style = "text-align:right;" }).HtmlAttributes(new { style = "text-align:right;" });
     })
  .DataSource(dataSource => dataSource
         .Ajax()
  .ServerOperation(false)
         .Read(read => read.Action("GetData", "Home"))
        
        .Group(groups =>
         {
             groups.Add(p => p.OwnerName);
         })
 
So here we have Group by with "OwnerName".  Our requirement is when we sort by "ShortDescription" it should first sort by "OwnerName" and then by "ShortDescription".  I know its possble by custom binding at server side - i took help from below article http://demos.telerik.com/aspnet-mvc/razor/grid/custombinding
 
But is it possible at client side? can we avoid server side trip? as .ServerOperation(false) works for normal grid.

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 13 May 2013, 12:05 PM
Hi Amol,


Since this is a duplicate of the question in the support thread, I will quote my answer here too


The default behavior of the Grid is to first sort by the group field i.e. "OwnerName" in the current scenario and then by the field in each group. If that is not the case in the current scenario, could please provide some additional information so I could assist you further?



As a side note, I would like to ask you to not post identical questions in multiple threads, so we could provide you a better assistance.

 

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