jqgrid更改单元格值并保持编辑模式

use*_*586 0 jqgrid

我在我的网格中使用内联编辑,我有一些情况,我想改变列内单元格的值.我正在使用setCell更改它,它运行良好.我的问题是,在更改后,单元格丢失了它的编辑模式,而该行的所有其他单元格都处于编辑模式.我想在更改后将单元格保持在编辑模式.

现在我所做的是保存了行,然后再次选择它并进入编辑模式 - 但我不认为这是一个很好的解决方案 - 有没有办法在改变时保持编辑模式?

提前致谢.

Ole*_*leg 5

如果您需要实现所有处于编辑模式的依赖关系单元格的行为,您必须手动修改单元格包含jQuery.html函数.如果要修改的列的名称具有名称"description",并且您在另一个"代码"列上使用"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);
                }
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

该代码适用于内联和表单编辑.

<select>您可以在此处找到依赖元素的工作示例.