无法在jqGrid中编辑可编辑列

时间:2012-07-24 02:07:42

标签: jquery jqgrid

我搜索了所有可用资源,但无济于事。我试图让一个列可编辑(见下面的第7列),但到目前为止没有任何作用。我已经将editable属性设置为true。我的猜测是它与网格属性集有关,但我不知道我需要编辑哪个属性,所以我的可编辑列可以工作。

$('#pGrdList0').jqGrid({
    "url" : "clientArray",
    "editurl" : "server.php",
    "datatype" : "local",
    "width" : "900",
    "height" : "338",
    "rowNum" : "1000",
    "colNames" : 
        [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ],
    "colModel" :
        [ {"name" : "g1", "index" : "g1", "width" : "115", "align" : "left", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g2", "index" : "g2", "width" : "15", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g3", "index" : "g3", "width" : "68", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g4", "index" : "g4", "width" : "68", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g5", "index" : "g5", "width" : "68", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g6", "index" : "g6", "width" : "68", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g7", "index" : "g7", "width" : "68", "align" : "right", "formatter" : numberFormatter, "formatoptions" : {thousandsSeparator:',',decimalPlaces:0,defaultValue:''}, "editoptions" : "{maxlength: 9, dataInit:setImeDisabled}", "editable" : true},
          {"name" : "g8", "index" : "g8", "width" : "68", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g9", "index" : "g9", "width" : "80", "align" : "right", "edittype" : null, "formatter" : null, "formatoptions" : null, "editoptions" : null, "editable" : false},
          {"name" : "g10", "index" : "g10", "width" : "215", "align" : "left", "edittype" : "text", "formatter" : null, "formatoptions" : null, "editoptions" : {maxLength:30, dataInit:setImeEnabled}, "editable" : true} ],
    "pager" : "#pGrdList0nav",
    "viewrecords" : false,
    "cellEdit" : true,
    "cellsubmit" : "clientArray",
    "multiselect" : false,
    "forceFit" : false,
    "shrinkToFit" : false,
    "pgbuttons" : false,
    "pginput" : false,
    "pgtext" : false,
    "onCellSelect": function(rowid, iCol, cellcontent, e) {
        var grid = $('#pGrdShinkoujoukenichiran0');
        grid.setSelection(rowid, true);
    }
});

2 个答案:

答案 0 :(得分:3)

我发现你的代码没有任何问题,我没有测试它,但我认为你应该这样写它

可编辑:true ....没有双引号

答案 1 :(得分:0)

我遇到了类似的事情......请记住,jqgrid是模块化的,因此您必须要求编辑选项包含在您的副本中。

因此,当您下载jqgrid时,请确保选中所有编辑选项。