1
votes

I am trying to allow sorting on a column in my grid but it seems it is sorting based on the formatted version as apposed to the bound data itself. I am using a clienttemplate to format it and if I remove that it works fine but the client needs it formatted this way.

Grid code: It is the requestedOn column that is giving me trouble.

@Code
                        Html.Kendo().Grid(Of MyRequestStatusView)() _
                        .Name("MyRequestGrid") _
                        .HtmlAttributes(New With {.class = "GridWrapper"}) _
                        .TableHtmlAttributes(New With {.id = "MyRequestGrid", .class = "GridFullWidth"}) _
                        .Columns(Sub(c)
                                         c.Bound(Function(p) p.requestId).Hidden(True)
                                         c.Bound(Function(p) p.profileName).Title("Profile Name").ClientTemplate("<a href='' onclick='MyRequestDiv();return false;'>${profileName}</a>")
                                         c.Bound(Function(p) p.profileType).Title("Profile Type")
                                         c.Bound(Function(p) p.requestType).Title("Request Type")
                                         c.Bound(Function(p) p.tergetUsersList).Title("Target Users")
                                         c.Bound(Function(p) p.requestedOn) _
                                         .Title("Requested On") _
                                         .ClientTemplate("#=kendo.toString(requestedOn,'dd MMM yyyy HH:mm') #")
                                         c.Bound(Function(p) p.requestStatus).Title("Request Status")
                                         c.Bound(Function(p) p.RejectedBy).Title("Rejected By")
                                         c.Bound(Function(p) p.rejectionComments).Title("Rejection Comments")
                                         c.Bound(Function(p) p.requestedOn).Title("Requested On").Hidden(True)
                                         c.Bound(Function(p) p.EPN).Title("EPN")
                                 End Sub) _
                        .Scrollable(Function(scrolling) scrolling.Height(170)) _
                        .Resizable(Function(resizing) resizing.Columns(True)) _
                        .Pageable(Function(page) page.ButtonCount(20)) _
                        .Selectable() _
                        .Sortable() _
                        .AutoBind(False) _
                        .DataSource(Function(d) d.Ajax() _
                                .ServerOperation(False) _
                        .Read(Function(read) read.Action("GetDashboardMyRequestGrid", "Home").Type(HttpVerbs.Post).Data("additionalData")) _
                        .Events(Function(events) events.Error("onError"))) _
                        .Events(Function(events) events.DataBound("onDataLoaded")) _
                        .Render()
                    End Code