我正在使用webgrid來顯示我的數據庫中的數據。問題在於排序選項不工作 這裏是我的WebGrid代碼webgrid排序不工作
@{
var grid = new WebGrid(Model, canPage:true ,canSort:true, rowsPerPage :4);
grid.Pager(WebGridPagerModes.NextPrevious);
@grid.GetHtml(tableStyle: "webGrid", htmlAttributes: new { id = "datatable" },
headerStyle: "webgrid-header",
selectedRowStyle : "webgrid-selected-row",
footerStyle : "webgrid-footer",
rowStyle: "webgrid-row-style",
alternatingRowStyle: "webgrid-alternating-row",
columns: grid.Columns(
grid.Column(header: "", format: (item) =>
Html.ActionLink("Détails", "Details", new { id = item.id_client }, new { @class = "details" }), style: "actions"),
grid.Column(header: "", format: (item) => Html.ActionLink("Modifier", "Edit", new { id = item.id_client }, new { @class = "modifier" }),style : "actions"),
grid.Column(header: "", format: (item) => Html.ActionLink("Supprimer", "Delete", new { id = item.id_client }, new { @class = "supprimer" }), style: "actions"),
grid.Column("Nom",canSort: true),
grid.Column("Prenom", "Prénom",canSort:true),
grid.Column("Email")));
}
好的,這種排序不適用於特定列或所有列嗎?也看到[這個鏈接](http://yassershaikh.com/mvc-3-web-grid-sorting-not-working/)可以幫助你 – Yasser 2012-08-06 11:23:20
是的,它只適用於一些列(它與int列和字符串一起工作列但不是全部) – Kira 2012-08-06 11:28:26
我認爲問題是當網格包含多個頁面 – Kira 2012-08-06 11:37:24