在编辑中获取对文本框元素的引用
Getting a reference to the text box elements on an edit
在我的 MVC 网格中,我按如下方式捕获编辑事件:
.Events(events => events.Change("gridRowChange").Edit("onEdit"))
在发生编辑时调用的 onEdit() 方法中,我想获取对行中每个可编辑单元格的文本框元素的引用,以便我可以将 onBlur 事件附加到某些他们中的。如何获取对正在编辑的行中每个文本框元素的引用?
根据 Telerik 的 OnEdit 文档:
The event argument exposes three fields:
dataItem - the JavaScript object to which the editor row is bound to. It is undefined during insertion.
mode - a string whose value is either "insert" or "edit"
form - the DOM element which contains all editing components (textboxes, checkboxes, dropdownlists etc.)
这应该为您提供对给定文本框的引用:
function onEdit(e) {
var yourTextBox = $(form).find("#your_id");
yourTextBox.on("blur", function () {
//your on blur code here
});
}
在我的 MVC 网格中,我按如下方式捕获编辑事件:
.Events(events => events.Change("gridRowChange").Edit("onEdit"))
在发生编辑时调用的 onEdit() 方法中,我想获取对行中每个可编辑单元格的文本框元素的引用,以便我可以将 onBlur 事件附加到某些他们中的。如何获取对正在编辑的行中每个文本框元素的引用?
根据 Telerik 的 OnEdit 文档:
The event argument exposes three fields: dataItem - the JavaScript object to which the editor row is bound to. It is undefined during insertion. mode - a string whose value is either "insert" or "edit" form - the DOM element which contains all editing components (textboxes, checkboxes, dropdownlists etc.)
这应该为您提供对给定文本框的引用:
function onEdit(e) {
var yourTextBox = $(form).find("#your_id");
yourTextBox.on("blur", function () {
//your on blur code here
});
}