问题描述
我的视图中有一个webgrid如下:
I have a webgrid in my view as follows:
@grid.GetHtml(
tableStyle: "webgrid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("PersonId", "Id"),
grid.Column("Name", header: string.Format("Name" + " {0}", grid.SortColumn == "Name" ? grid.SortDirection == SortDirection.Ascending ? "▼" : "▲" : ""), canSort: true, style: "px20"),
grid.Column("PersonContactNo","Contact No")
)
某个用户的
我使用如下所示的javascript隐藏了第3列:
for a certain user i have hidden the 3rd column using javascript like below:
$(document).ready(function () {
hideColumnColorRow(3); //hide Contact No. column
});
(function ($) {
hideColumnColorRow = function (column) {
$('td:nth-child(' + column + '),th:nth-child( ' + column + ')').hide();
};
})(jQuery);
代码在调试时工作正常,但每当我尝试点击名称超链接对列表进行排序时,隐藏列重新出现......如何我是否让webgrid保持其状态???
请求帮助我....
the code works fine while debugging but whenever i try to click on the "Name" hyperlink to sort the list, the hidden column reappears...how do i get the webgrid to retain its state???
pleas help me on this....
推荐答案
代码在调试时工作正常,但每当我尝试点击名称超链接对列表进行排序时,隐藏列重新出现......如何我是否让webgrid保持其状态???
请求帮助我....
the code works fine while debugging but whenever i try to click on the "Name" hyperlink to sort the list, the hidden column reappears...how do i get the webgrid to retain its state???
pleas help me on this....
这篇关于保留webgrid的当前状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!