Inline editing is started using edit formatter action button.
If clicked in other row, old row remains in inline edit mode.
How to end old row indline edit if clickedin other row.
According to
http://www.trirand.com/blog/?page_id=393/bugs/wrong-hovering-effect-in-actions-formatter-of-jqgrid-4-1-0
it looks line this is solved in 4.1.2 but actually the problem persists.
Update
Using Oleg workaround exception occurs if custom element is used.
Line where exception occurs is marked in comment in code below
// this is jqgrid custom_element property value:
function combobox_element(value, options, width, colName, entity, andmetp) {
var elemStr;
if (options.id === options.name)
// form
elemStr = '<div>' +
'<input class="FormElement ui-widget-content ui-corner-all" style="vertical-align:top" size="' +
options.size + '"';
else
elemStr = '<div>' +
'<input class="FormElement ui-widget-content " style="height:17px;vertical-align:top;width:' +
width + 'px" ';
elemStr += ' value="' + value + '"' + ' id="' + options.id + '"/>';
elemStr += '<button style="height:21px;width:21px;" tabindex="-1" /></div>';
var newel = $(elemStr)[0];
setTimeout(function () {
$(newel).parent().css({ display: "inline-block" }).parent().css({ 'padding-bottom': 0 });
// click in edit button in action input variable is undefined, newel does not contain input element:
var input = $("input", newel);
}, 500);
return newel;
}
Update2
I try to explain new issue more clearly.
Before adding
onEdit = @"function (id) {
if (typeof (lastSelectedRow) !== 'undefined' && id !== lastSelectedRow) {
cancelEditing($('#grid'));
}
lastSelectedRow = id;
}
event handler exception on custom element does not occur.
After adding onEdit event handler below custom editing elements are not created anymore. So custom editing elements cannot used in inline editing if this onEdit handler is present.
I commented out cancelEditing code but problem persists.
It looks like this onEdit event handler prevents custom editing element creation.
Update 3
I tried demo provided in Oleg answer. If inline edit is started by double click in row, action buttons do not change. It is not possible to use save and cancel buttons in this case.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…