感谢大佬的资料https://blog.csdn.net/Easy_____/article/details/30218421
虽然没实例,但也给了一些信息。我以为cellsubmit属性是添加到colModel里面的!实际并不是,
而是添加到jqGrid里面
//加载Grid
function LoadGrid() {
$("#gridTable1").jqGrid({
datatype: "local",
height: $(window).height() - 550,
autowidth: true,
colModel: [
{ label: "商品名称", name: "goodsName", index: "goodsName", width: 450, align: "center" },
{ label: "商品Sku", name: "orderSku", index: "orderSku", width: 200, align: "center" },
{ label: "商品件数", name: "count", index: "count", width: 90, align: "center" },
{ label: "原始出厂单价", name: 'primitiveFactoryPrice', index: 'primitiveFactoryPrice', width: 200, sorttype: "float", align: "center" },
{ label: "规格", name: 'spec', index: 'spec', width: 100, align: "center" },
{ label: "单位", name: "unit", index: "unit", width: 50, align: "center" },
{
label: "物流单号*", name: "waybill",
index: "waybill", width: 200, align: "center"
},
{
label: "物流公司*", name: "company",
index: "carrier", width: 200, align: "center"
},
],
viewrecords: true,
rowNum: 30,
rownumbers: true,
shrinkToFit: false,
gridview: true,
cellEdit: true,
cellsubmit: "clientArray",//不需要传入后台 设置为clientArray。需要的时候可以设置为romote
//gridComplete: function () {
// var ids = jQuery("#gridTable1").jqGrid('getDataIDs');
// for (var i = 0; i < ids.length; i++) {
// var cl = ids[i];
// var ae = '';
// var be = '';
// jQuery("#gridTable1").jqGrid('setRowData', ids[i], { company: be ,waybill:ae});
// }
//}
});
$("#gridTable1").setColProp("waybill", { editable: true });//设置列可编辑
$("#gridTable1").setColProp("company", { editable: true });//设置列可编辑
}
运行结果
我的jqGrid版本的colModel属性设置了editable并不支持
然后用setColProp方法才支持
$("#gridTable1").setColProp("waybill", { editable: true });//设置列可编辑
$("#gridTable1").setColProp("company", { editable: true });//设置列可编辑
手机扫一扫
移动阅读更方便
你可能感兴趣的文章