Jquery plugins Jquery网格行保留在编辑的表单中。调用saveRow事件并单击另一行

Jquery plugins Jquery网格行保留在编辑的表单中。调用saveRow事件并单击另一行,jquery-plugins,jqgrid,Jquery Plugins,Jqgrid,我在jquery对话框中加载了一个网格。我已经在OnSetrow事件中完成了行编辑和行保存。当编辑并保存一行,然后单击另一行时,上一行将保留在已编辑的表单中。我无法保存和删除已编辑的表单 我要在其上加载网格的表的Id为MultiCount 我将网格绑定到函数bindShapesGrid()中,下面是代码。 我硬编码了一个XML字符串并将其用作数据 函数bindShapesgrid(){ var xmlstring=“ShortNameValueNotequalAndSad” var-lastse

我在jquery对话框中加载了一个网格。我已经在OnSetrow事件中完成了行编辑和行保存。当编辑并保存一行,然后单击另一行时,上一行将保留在已编辑的表单中。我无法保存和删除已编辑的表单

我要在其上加载网格的表的Id为MultiCount

我将网格绑定到函数bindShapesGrid()中,下面是代码。 我硬编码了一个XML字符串并将其用作数据

函数bindShapesgrid(){

var xmlstring=“ShortNameValueNotequalAndSad”
var-lastsel2;
jQuery(“#MultiCount”).jqGrid({
数据类型:“xmlstring”,
datastr:xmlstring,
colNames:['ShortName','operand1','value1','AndOr','operand2','value2'],
colModel:[{name:'ShortName',index:'ShortName',align:'center',width:80,edit:true,edittype:'select'},
{name:'operan1',index:'operan1',align:'center',width:90,edittype:'select',editoptions:{value:retrievegridoperanlist()},
{name:'Value1',index:'Value1',align:'center',width:40,editable:true},
{name:'AndOr',index:'reference',align:'center',width:80,edittype:'select',editoptions:{value:'AND:AND;OR:OR},
{name:'operan2',index:'operan2',align:'center',width:80,edittype:'select',edit:true,editoptions:{value:retrievegridoperanlist()},
{name:'Value2',index:'Value2',align:'center',width:40,editable:true}],
root:'行',
行:'行',
是的,
sortname:“ShortName”,
排序器:“asc”,
viewrecords:是的,
gridview:没错,
高度:“100%”,
rowNum:10,
OnSetrow:功能(id){
if(id&&id!==lastsel2){
jQuery('#MultiCount').jqGrid('editRow',id,true);
jQuery(“#MultiCount”).jqGrid('saveRow',lastsel2,true);
lastsel2=id;
}
}
});
}
        var xmlstring = "<root><rows><row><cell>Shortnamevalue</cell><cell>does not equal</cell><cell>and</cell><cell>sad</cell><cell></cell><cell></cell></row><row><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row></rows></root>"
        var lastsel2;

        jQuery("#MultiCount").jqGrid({
            datatype: 'xmlstring',
            datastr: xmlstring,
            colNames: ['ShortName', 'Operand 1', 'Value 1', 'AndOr', 'Operand 2', 'Value 2'],
            colModel: [{ name: 'ShortName', index: 'ShortName', align: 'center', width: 80, editable: true, edittype: "select" },
                      { name: 'Operand1', index: 'Operand1', align: 'center', width: 90, editable: true, edittype: "select", editoptions: { value: RetrievegridOperandList() } },
                      { name: 'Value1', index: 'Value1', align: 'center', width: 40, editable: true },
                      { name: 'AndOr', index: 'Refer', align: 'center', width: 80, editable: true, edittype: "select", editoptions: { value: "AND:And;OR:Or" } },
                      { name: 'Operand2', index: 'Operand2', align: 'center', width: 80, edittype: "select", editable: true, editoptions: { value: RetrievegridOperandList() } },
                      { name: 'Value2', index: 'Value2', align: 'center', width: 40, editable: true }],

            root: 'rows',
            row: 'row',


            celledit: true,
            sortname: 'ShortName',
            sortorder: 'asc',
            viewrecords: true,
            gridview: true,
            height: "100%",
            rowNum: 10,



            onSelectRow: function (id) {

                          if (id && id !== lastsel2) {

                         jQuery('#MultiCount').jqGrid('editRow', id, true);
                         jQuery("#MultiCount").jqGrid('saveRow', lastsel2, true);

                          lastsel2 = id;
                                }
                            }

                  });

            }