1
我想要一個排序指標作爲webgrid列升序和降序的圖像。我做了谷歌搜索,找到了解決辦法爲:webgrid排序指標,asp.net mvc3剃刀
<script type="text/javascript">
$('thead > tr > th > a[href*="[email protected]"]').parent()
.append('@(grid.SortDirection == SortDirection.Ascending ? "U" : "D")');
</script>
But i used the webgrid like this:
var grid = new WebGrid(canPage: true, rowsPerPage: SlmgWebApp.Controllers.HomeController.PageSize, canSort: true, ajaxUpdateContainerId: "grid", fieldNamePrefix: "ViewClaimfieldname", pageFieldName: "ViewClaimpagename");
grid.Bind(Model.TotalClaims, rowCount: Model.TotalRecords, autoSortAndPage: false);
grid.Pager(WebGridPagerModes.All);
@grid.GetHtml(
tableStyle: "webgrid",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
selectedRowStyle: "webgrid-selected-row",
htmlAttributes: new { id = "grid" },
columns: grid.Columns(
grid.Column("", header: "", format: @<span><img alt="image1" src="@item.StatusIcon" title="@item.StatusName" style="height:25px; width:25px; border:0px" /></span>),
grid.Column("CustomerName", header: "Reference"),
grid.Column("RepairOrderNumber", header: "Repair Order"),
grid.Column("SlmgReferenceNumber", header: "SLMG Number", format: @<text><a href="javascript: getclaim('@item.SlmgReferenceNumber')">@item.SlmgReferenceNumber</a></text>),
grid.Column("EquipmentManfacturer", header: "Warranty Provider"),
grid.Column("SerialNumber", header: "Serial Number (P&A Number)")
));
}
如果我把在頁面加載它拋出錯誤,網格沒有加載JavaScript函數。我已經給ajax調用了加載這個webgrid的數據。任何人可以幫助我,我必須放置此JavaScript,以便我可以得到一個指標,在webgrid排序列。
我無法接到你.. – 2012-01-02 06:27:03
我不知道我的評論發生了什麼,通過提高你的接受率我打算接受你對你以前的答案問題 – 2012-01-02 06:31:30