How to set default column sorting to a grid

5 Answers 13853 Views
Grid
Yj
Top achievements
Rank 1
Yj asked on 27 Apr 2012, 07:15 PM
I have a Keno Grid,  when first launched, it should be sorted on one column by descending order. How can achieve it? Is there any configuration parameters to set?

5 Answers, 1 is accepted

Sort by
1
Masaab
Top achievements
Rank 1
answered on 18 Aug 2014, 03:17 AM
TO Sort a Grid That is bound to a server dataSource.
 
@(Html.Kendo().Grid<DataTableRow>()<br>                                    .Name("GridDisplay")<br>                                    .DataSource(dataSource =><br>                                                {<br>                                                    dataSource<br>                                                        .Ajax()<br>                                                        .Read(read => read.Action("ActionName", "Controller", new  {Id = @Model.Id}))<br>                                                        .PageSize(10)<br>                                                        .Sort(a => a.Add("Date/Time").Descending())<br>                                                        .ServerOperation(false);<br><br>                                                }<br>                                    )
1
Brice
Top achievements
Rank 2
answered on 14 Sep 2018, 11:18 AM

Default sorting should be defined in the datasource configuration. 

You could check documentation at this adress: https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/sort#sort

 

Example : 

var dataSource = new kendo.data.DataSource({
  data: [
    { name: "Jane Doe", age: 30 },
    { name: "John Doe", age: 33 }
  ],
  sort: { field: "age", dir: "desc" }
});
0
Sebastian
Telerik team
answered on 18 Jun 2014, 08:05 AM
This should be the proper link to the relevant help article section, guys:
http://docs.telerik.com/kendo-ui/api/framework/datasource#configuration-serverSorting

Regards,
Sebastian
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Dan
Top achievements
Rank 1
commented on 22 Aug 2014, 05:16 PM

Thanks for the correct link!
-1
Pechka
Top achievements
Rank 1
answered on 01 May 2012, 06:25 AM
pucsoftware
Top achievements
Rank 1
commented on 10 Dec 2012, 09:38 PM

I also need to have the grid's sort property established on the initial page request. The link provided below show's how to invoke the "sort" method of the data source but not how to pre-configure the datastore or grid to already have an initial sorted field. I'm sure it can be done but don't see how based on this link. Can you provide more info?
Chrys
Top achievements
Rank 1
commented on 17 Jun 2014, 10:54 PM

This seems to be bad link only links to the landing page for keno
-1
Marcin Butlak
Top achievements
Rank 2
answered on 11 Dec 2012, 10:27 PM
Tags
Grid
Asked by
Yj
Top achievements
Rank 1
Answers by
Masaab
Top achievements
Rank 1
Brice
Top achievements
Rank 2
Sebastian
Telerik team
Pechka
Top achievements
Rank 1
Marcin Butlak
Top achievements
Rank 2
Share this question
or