jqgrid & Lib.Web.Mvc.JQuery.JqGrid.DataAnnotations:how hide column?
我有这个 jqgrid
1
2 3 4 5 6 7 8 9 10 11 12 13 14 |
var grid = new JqGridHelper<VisualisationModel>(
“gridVisualizzazioni”, caption: null, dataType: JqGridDataTypes.Json, methodType: JqGridMethodTypes.Post, pager:true, sortingName:”IndicatoreVisualizzazioniPk”, sortingOrder: JqGridSortingOrders.Asc, url: Url.Action(“LoadGrid”, new { indicatorePk = Model.IndicatorePk }), autoWidth: true, viewRecords: true, loadComplete:”SetCellBackColor”); |
在我的模型中,我创建了一些列…
特别是
1
2 3 |
[Required]
[JqGridColumnFormatter(JqGridColumnPredefinedFormatters.Integer)] public int AggregazioniDatiId { get; set; } |
是否可以通过DataAnnotation隐藏jqGrid中的上述列?
我试过
1
|
[ScaffoldColumn(false)]
|
但在 colModel 中该列不出现,然后我的 jquery 代码不起作用
1
2 3 |
var grid = $(“#gridVisualizzazioni”);
var selRowId = grid.jqGrid(‘getGridParam’, ‘selrow’); var celValue = grid.jqGrid (‘getCell’, selRowId, ‘AggregazioniDatiId’); |
提前致谢。
萨拉
- [HiddenInput(DisplayValue = false)] 你试过这个吗?同样的错误?
- 或者在这个 trirand.net/demoaspnetmvc.aspx 中,在他们对列使用可编辑:假的模型中,您也可以使用隐藏:真。我不知道你是如何构建你的网格的。
- @PiyushSardana 谢谢。 [HiddenInput(DisplayValue = false)] 有效!
试试这个:
1
|
[HiddenInput(DisplayValue = false)]
|
来源:https://www.codenong.com/12051603/