似乎错误的onClickSubmit正在被解雇。在加载网格时,如果我单击编辑按钮并提交编辑火的onclicksubmit是正确的。但是当我点击添加编辑火灾的onclicksubmit时!
如果我重新加载页面并点击添加正确的添加火的onClickSubmit,接下来我尝试编辑添加火的onclickSubmit ..请帮助!!
这是
的代码 jQuery("#treegrid").jqGrid('navGrid', '#ptreegrid', {
view:true, refresh:true, search:false},//options
{width:700, height:300, checkOnSubmit:true, reloadAfterSubmit:true,
ajaxEditOptions: { contentType: 'application/json; charset=utf-8' },
closeAfterEdit:true, closeOnEscape:true, bottominfo:"Fields marked with (*) are required",
afterShowForm: function(eparams) {
jQuery("#treegrid").setGridParam({datatype:'json'});
},
onclickSubmit: function(rp_ge, postdata) {
var rowid = jQuery("#treegrid").getGridParam('selrow');
var rowdata = jQuery("#treegrid").getRowData(rowid);
rp_ge.url = '../v1/OutlineItem?'+'&text='+$.URLEncode($("#text").val())+'&oper=edit'+
'&id='+rowid;
}
}, // edit options end
{width:700, height:300, checkOnSubmit:true, reloadAfterSubmit:true,
closeAfterAdd:true, processData:"Processing",
ajaxAddOptions: { contentType: 'application/json; charset=utf-8' },
closeOnEscape:true, bottominfo:"Fields marked with (*) are required",
afterShowForm: function(eparams) {
jQuery("#treegrid").setGridParam({datatype:'json'});
},
onclickSubmit: function(rp_ge, postdata) {
var rowid = jQuery("#treegrid").getGridParam('selrow');
var rowdata = jQuery("#treegrid").getRowData(rowid);
rp_ge.url = '../v1/OutlineItem?'+'&text='+$.URLEncode($("#text").val())+'&oper=add'+
'&id='+rowid;
}
}, // add options end
{reloadAfterSubmit:true,closeOnEscape:true, mtype:"DELETE",
ajaxDeleteOptions: { contentType: 'application/json; charset=utf-8' },
serializeDelData: function (postdata) {
return ""; // the body MUST be empty in DELETE HTTP requests
},
onclickSubmit: function(rp_ge, postdata) {
var rowid = jQuery("#treegrid").getGridParam('selrow');
var rowdata = jQuery("#treegrid").getRowData(rowid);
rp_ge.url = '../v1/OutlineItem?'+'id='+rowid;
}
}, // del options
{closeOnEscape:true} // search options
);
jQuery("#treegrid").jqGrid('navButtonAdd',"#ptreegrid",
{caption:"",title:"Move Up", buttonicon :'ui-icon-arrowthick-1-n',
onClickButton:function(){
var rowid = jQuery("#treegrid").getGridParam('selrow');
jQuery("#selOutlineItemIdField").val(rowid);
var temp = jQuery("#selOutlineItemIdField").val();
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
accepts: 'application/json; charset=utf-8',
url: '../v1/OutlineItem?oper=up&id='+rowid,
data: 'oper=up&id='+rowid,
// dataType:'json',
async:false,
cache:false,
错误:function(){
},
成功:函数(数据){
jQuery的( “#的TreeGrid”)触发器( “reloadGrid”);
jQuery的( “#的TreeGrid”)的jqGrid( '为setSelection',温度)。
}
});
}
});
答案 0 :(得分:1)
我能够使用recreateForm:在编辑和添加时使用true,不知道为什么我需要这样做。有什么想法??