【问题标题】:Add jqGrid data back to json将 jqGrid 数据添加回 json
【发布时间】:2014-01-15 09:24:32
【问题描述】:

对 jqGrid 使用内联编辑:

我在变量“jsonDataStr”中有 json 数据。数据使用 jqGrid 显示。

 $("#myGrid").jqGrid({
            colModel: [
                { name: 'authenticate', width: "80" ,align: 'center',formatter: 'checkbox',editable:true,edittype:"checkbox", editoptions:{value: "Yes:No"}, formoptions:{ rowpos:1, label: "Authenticate ", elmprefix:"(*)"},editrules:{required:true} },
                { name: 'authorize', width: "80" ,align: 'center',formatter: 'checkbox',editable:true,edittype:"checkbox", editoptions:{value: "Yes:No"}, formoptions:{ rowpos:1, label: "Authorize ", elmprefix:"(*)"},editrules:{required:true}},
            ],
            pager: '#pagerTable',
            colNames:[ 'authenticate','authorize'],
            datatype: "jsonstring",
            datastr: jsonDataStr,
            jsonReader: { repeatitems: false },
            viewrecords: true,pginput : false, forceFit :true,
            height: 83,caption :"Permissions",
            ignoreCase: true,scrollBar : false
        });


        $("#myGrid").navGrid("#pagerTable",{edit:false,add:false,del:false,search:false,refresh:false});
        $("#myGrid").inlineNav("#pagerTable");

它正在正确显示。

现在当我保存行时,我想将数据保存到同一个 json 变量“jsonDataStr”。此外,我想在json行中添加信息,

如添加、修改或删除。有什么简单的方法可以做到这一点?

有人可以帮忙吗?

【问题讨论】:

    标签: jqgrid


    【解决方案1】:

    也许这会有所帮助

    var jsonDataStr = "some Data you need";
    $("#YourGrid").jqGrid('setGridParam', { jsonDataStr: jsonDataStr }); 
    $('#YourGrid').trigger('reloadGrid');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-22
      • 1970-01-01
      相关资源
      最近更新 更多