jqgrid& Lib.Web.Mvc.JQuery.JqGrid.DataAnnotations:如何隐藏列?

时间:2012-08-21 09:08:04

标签: jquery jqgrid data-annotations lib.web.mvc

我有这个jqgrid

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");

在我的模型中,我创建了一些专栏......

特别是

[Required]
[JqGridColumnFormatter(JqGridColumnPredefinedFormatters.Integer)]
public int AggregazioniDatiId { get; set; }

可以通过DataAnnotation隐藏jqGrid中的上一列吗?

我试过

[ScaffoldColumn(false)]

但是在colModel中没有出现该列,然后我的jquery代码不起作用

var grid = $("#gridVisualizzazioni");
var selRowId = grid.jqGrid('getGridParam', 'selrow');
var celValue = grid.jqGrid ('getCell', selRowId, 'AggregazioniDatiId');

提前致谢。

萨拉

1 个答案:

答案 0 :(得分:3)

试试这个:

[HiddenInput(DisplayValue = false)]