如何在编辑时在Jqgrid上禁用保存处理程序 [英] How to disable Save Handler on Jqgrid while doing editing
问题描述
我正在使用Jqgrid开发ASP.net MVC 4.0应用程序。
I am working on an ASP.net MVC 4.0 application with Jqgrid.
我正在将所有行设置为可编辑,其中某些列可编辑和某些不可编辑。
I am making all rows as editable with some columns being editable and some non editable.
这里的问题是,我不想使用保存和ESC处理程序。
The Problem here is , i dont want to use Save and ESC handlers.
我正在保存其中一个文本框的模糊事件的行详细信息。仍然需要保持 EDIT 模式。
I am saving row details on the blur event of one of the text boxes. and still i need to stay in EDIT Mode.
因此,如果用户错误地按Enter键,则该行将退出编辑模式。
So, if the user mistakenly presses enter , the row is going out of edit mode.
如何禁用这些 Esc 和 Save 处理程序
How to disable these Esc and Save Handlers
请帮助。
已更新:
我是
I am not using either cell edit or inline editing or form editing.
我正在将所有行转换为在Jqgrid的loadComplete触发器上可编辑的
I am converting all rows as editable on the loadComplete trigger of the Jqgrid
我只有一个列是可编辑的。类型为文本框
i have only one Column being editable. that is of type Textbox
因此,在发生模糊事件时,我将使用ajax发布将其保存到数据库中。
So, on the blur event of it , i am saving that to database using an ajax post .
到目前为止,一切正常。
Every thing is working fine upto this.
这里,即使在将值保存到数据库。
但是,当单击该行上的enter时,它正在退出编辑模式,这违反了我的要求
But, when clciking on enter on that row, it is moving out of edit mode which violates my requirement
当按下ESC或Enter键时,我需要停止将行从编辑模式移至查看模式
我希望这很清楚。.如果没有,我会再说更多。.
I hope this is clear..if not i will mention more..
推荐答案
我以这种方式解决了这个问题:
I Solved it in this way:
不知道这样做是否正确:
Dont know whether it is right way of doing this:
Oleg ..我需要您对此的看法:
Oleg..i need your views on this:
if(cnt > 0) {
svr.id = rowid; $t.p.savedRow.push(svr);
$(ind).attr("editable","1");
$("td:eq("+focus+") input",ind).focus();
if(o.keys===true) {
$(ind).bind("keydown",function(e) {
if (e.keyCode === 27) {
// debugger
// $($t).jqGrid("restoreRow",rowid, o.afterrestorefunc);
// if($t.p._inlinenav) {
// try {
// $($t).jqGrid('showAddEditButtons');
// }
// catch (eer1) {}
// }
return false;
}
if (e.keyCode === 13) {
// var ta = e.target;
// if(ta.tagName === 'TEXTAREA') { return true; }
// if( $($t).jqGrid("saveRow", rowid, o ) ) {
// if($t.p._inlinenav) {
// try {
// $($t).jqGrid('showAddEditButtons');
// } catch (eer2) {}
// }
// }
return false;
}
});
}
$($t).triggerHandler("jqGridInlineEditRow", [rowid, o]);
if( $.isFunction(o.oneditfunc)) { o.oneditfunc.call($t, rowid); }
}
这是代码,我在 Jqgrid.src中找到.js
自此,我确实需要在 Enter 键或 ESC 被按下,我注释掉了代码。
Since, i done need restoreRow and saveRow to be called when Enter key or ESC is pressed, i commented out the code .
我不知道这样做是否正确。但这确实适用于我的方案。
这篇关于如何在编辑时在Jqgrid上禁用保存处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!