隐藏webgrid中的列?
问题描述:
如何隐藏webgrid中的列?我应该可以从网格中访问这些值,但用户不应该能够看到网格中的列。没有条件,但完全我想隐藏那些列隐藏webgrid中的列?
我的专栏是
grid.Column(header: "Phone")
答
也许最简单的方法是只使用一些CSS/jQuery的地方“TABLECLASS”是你的表的类的名称:
table.TABLECLASS th:first-child, table td:first-child {
display: none;
}
我不认为有通过内置的WebGrid做到这一点的方法。
答
如果你想隐藏的第2列,例如:
$(document).ready(function()
{
$("#yourGridId th:nth-child(2)").hide();
$("#yourGridId td:nth-child(2)").hide();
}
http://stackoverflow.com/questions/7172420/mvc-3-webgrid-how-do-you-hide-columns-你-拒收想将要可见 – SidharthRoy 2014-01-08 09:42:26