This project is read-only.

Initial sort not working on grid

Jun 21, 2016 at 6:46 PM

I am trying to display my grid with default sorting applied to the id column, as below:
@Html.Grid(Model.Reports).Columns(columns =>
            columns.Add(m => m.ReportID)
            columns.Add(m => m.RecordNumber)
                .Titled("Rpt Num")
                .RenderValueAs(m => @<b> @Html.ActionLink(m.RecordNumber.ToString(), "CreateEditReport", "Home", new { recordnumber = m.RecordNumber }, null)</b>);    
But when the grid loads initially, no sorting is applied at all.
And sorting does work - if I click on the id column header, it sorts as desired. It just doesn't seem to fire when the grid is initially loaded. I need to know how I can get sorting applied to the grid before it displays.

Any assistance or advice is greatly appreciated.
Aug 8, 2017 at 10:30 PM
Maybe you should attempt to sort your data on the server side before returning it to your view, then when a column header is clicked, your data will be sorted appropriately.