问题描述
我已经使用HTML帮助器实现了Kendo网格.除排序外,其他所有东西都起作用,当我单击排序箭头时,它会思考并刷新相同的数据.
I have implemented a Kendo grid using Html helpers. Everything works but the sorting, when I click the sorting arrows, it thinks and refreshes the same data.
<div id="SearchResults">
@{
var grid = Html.Kendo().Grid<SearchCOESGridViewModel>();
grid.Name("COESResultGrid")
.Columns(columns =>
{
columns.Bound(s => s.COESNo).Title(@SearchCOES.COESGridHeading);
columns.Bound(s => s.Postcode).Title(@SearchCOES.PostcodeGridHeading);
columns.Bound(s => s.AuditAuthNo).Title(@SearchCOES.AuditAuthGridHeading);
columns.Bound(s => s.COESNo).Title("").ClientTemplate("<a href='javascript:void(0)' data-id='#= COESNoValue #' class='edit-link'>" + @Grid.EditAction + "</a>").Sortable(false);
});
grid.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add("COESNo").Ascending())
.Read(read => read.Action("SearchGridData", "PrepareCOES"))).AutoBind(false);
grid.Pageable();
grid.Sortable();
@grid
}
</div>
如果我使用的是Ajax数据绑定,如何进行排序?
How can I do sorting if I am using ajax data binding?
分页工作正常.只是排序似乎没有排序,我使用的是Chrome浏览器,可以看到发回了一个请求,但是没有排序
The paging works fine. Its just the sorting that doesn't seem to sort, I am using Chrome and I can see a request being sent back, but no sort happens
推荐答案
好的,我已经解决了.我没有包含kendo.aspnetmvc.js脚本.我有kendo.web.js.但是我都需要.现在可以正常工作.
Its ok I just worked it out. I didn't have the kendo.aspnetmvc.js script included. I had the kendo.web.js. But I need both. Works fine now.
这篇关于如何使用HTML帮助器对Kendo网格进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!