我在网格中使用内联编辑,在某些情况下我想更改列内单元格的值。我用 setCell 更改它,效果很好。我的问题是,更改后,单元格失去了编辑模式,而该行的所有其他单元格都处于编辑模式。我想在更改单元格后将其保持在编辑模式。
现在我所做的是保存该行,然后再次选择它并在编辑模式下进行 - 但我认为这不是一个好的解决方案 - 有没有办法在更改时保持编辑模式?
提前致谢。
如果您需要实现全部处于编辑模式的依赖单元格的行为,您必须手动修改单元格包含的内容jQuery.html http://api.jquery.com/html/例如函数。如果您要修改的列的名称为“description”,并且您在另一个“code”列上使用“blur”事件,那么您可以执行以下操作
editoptions: {
dataEvents: [
{
type: 'blur',
fn: function(e) {
var newCodeValue = $(e.target).val();
// get the information from any source about the
// description of based on the new code value
// and construct full new HTML contain of the "description"
// cell. It should include "<input>", "<select>" or
// some another input elements. Let us you save the result
// in the variable descriptionEditHtml then you can use
// populate descriptionEditHtml in the "description" edit cell
if ($(e.target).is('.FormElement')) {
// form editing
var form = $(e.target).closest('form.FormGrid');
$("#description.FormElement",form[0]).html(descriptionEditHtml);
} else {
// inline editing
var row = $(e.target).closest('tr.jqgrow');
var rowId = row.attr('id');
$("#"+rowId+"_description",row[0]).html(descriptionEditHtml);
}
}
}
]
}
该代码适用于内联编辑和表单编辑。
依赖的工作示例<select>
你可以找到的元素here http://www.ok-soft-gmbh.com/jqGrid/DependendSelects3.htm.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)