如何在jqgrid中禁用字段列?

时间:2011-08-13 12:25:50

标签: jqgrid field

如何在jqgrid中禁用字段列? 这是我的代码:

jQuery("#penanggungJawab").jqGrid({
    mtype: "GET",
    datatype:"json",
    height: 50,
    width:900,
    colNames:['ID Card','Type Id Card','NO Id Card', 'Expired Date'],
    colModel:[ {
        name:'idCardIdPnggungJwb',
        index:'idCardIdPnggungJwb',
        width:310,
        editable:true,
        hidden:false,
        ***disabled:true***
    }, {
        name:'typeIdCardPnggungJwb',
        index:'typeIdCardPnggungJwb',
        width:310,
        editable:true,
        edittype:"select",
        editoptions:{value:"KTP:KTP;IDC:ID Card Company"},
        jsonmap:'typeIdCard'
    }, {
        name:'nomorIdCardPnggungJwb',
        index:'nomorIdCardPnggungJwb',
        width:310,
        editable:true
    },{
        name:'expiredDatePnggungJwb',
        index:'expiredDatePnggungJwb',
        width:310,
        editable:true,
        editoptions:{size:12, dataInit:function(el) {
            $(el).datepicker({dateFormat:"yy/mm/dd",changeMonth: true,changeYear: true});
        },
    }}],
    rowNum:10,
    rowList:[10,20,30],
    pager: '#Keuangan',
    sortname: 'typeIdCardPenanggungJawabKeuangan',
    viewrecords: true,
    sortorder: "desc",
    caption:"Grid No Kartu Identitas",
    editurl: "noabjad.json"
}); jQuery("#penanggungJawab").jqGrid('navGrid','#Keuangan',{
    del:false,
    search:false,
    edit:false
},{
    reloadAfterSubmit:false
},{
    reloadAfterSubmit:false
});

我可以禁用其中一个无法编辑的列吗?

1 个答案:

答案 0 :(得分:3)

如果我理解您的要求是正确的,您需要使用

editoptions: {disabled: true}
'idCardIdPnggungJwb'列的

选项。结果您将看到here