保存行而不是恢复数据
当我选择另一行时,我想保存数据而不是恢复数据。我怎样才能做到这一点?
我一直在使用此代码进行测试,但没有任何结果:
onSelectRow: function(row_id) {
if(row_id && row_id !== last_selected) {
/*
* Save row.
*/
$('#grid').jqGrid('saveRow', ((last_selected !== undefined)?last_selected:row_id) , true, function() {/* OnEditFunction */}, function(response) {
/* SuccessFunction */
var row_to_save = ((last_selected !== undefined)?last_selected:row_id);
success_function(row_to_save, response);
}, 'http://some_url.com');
last_selected = row_id;
}
/*
* Edit row.
*/
$('grid').jqGrid('editRow', row_id, true, function() {/* OnEditFunction */}, function(response) {
/* SuccessFunction */
success_function(row_id, response);
}, 'http://some_url.com');
},
如果我能够在成功保存行之前触发成功函数,那就太好了,这样我就可以显示通知消息。
提前致谢。
I want to save the data instead of restore it when I select another row. How I can accomplish that?
I've been testing with this code without any results:
onSelectRow: function(row_id) {
if(row_id && row_id !== last_selected) {
/*
* Save row.
*/
$('#grid').jqGrid('saveRow', ((last_selected !== undefined)?last_selected:row_id) , true, function() {/* OnEditFunction */}, function(response) {
/* SuccessFunction */
var row_to_save = ((last_selected !== undefined)?last_selected:row_id);
success_function(row_to_save, response);
}, 'http://some_url.com');
last_selected = row_id;
}
/*
* Edit row.
*/
$('grid').jqGrid('editRow', row_id, true, function() {/* OnEditFunction */}, function(response) {
/* SuccessFunction */
success_function(row_id, response);
}, 'http://some_url.com');
},
It could be great if I could be able to fire a success function before the row is saved successfully, so I can show a notification message.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您遇到这个问题是因为您在 saveRow 或 editRow。方法 editRow 只是转发
succesfunc< /code> 参数 saveRow,因此您可以在 saveRow。您可以阅读以下内容:
因此,您至少应该包含
return true;
作为succesfunc
实现的最后一个语句。I suppose that you have the problem because one small error in your current implementation of the
succesfunc
which you use in saveRow or editRow. The method editRow just forward thesuccesfunc
parameter to saveRow, so you will find the detailed description of thesuccesfunc
parameter in the documentation of the saveRow. You can read the following:So you should at least include
return true;
as the last statement of your implementation of thesuccesfunc
.