Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 类似于JqGrid中表单编辑的setCell_Javascript_Jquery_Asp.net_Jqgrid - Fatal编程技术网

Javascript 类似于JqGrid中表单编辑的setCell

Javascript 类似于JqGrid中表单编辑的setCell,javascript,jquery,asp.net,jqgrid,Javascript,Jquery,Asp.net,Jqgrid,好的,我一直在@Oleg的很多答案中寻找答案,但我什么都找不到。我有一个网格,其中一个可以在线编辑,在某些字段中,我使用自动完成,当我选择某个项目时,我使用setCell,将值写入另一个字段。我的专栏模型是这样的 { name: 'Label', index: 'Label', width: 100, align: 'Center', sorttype: "string", editable: true, editrules: { required: true }, editop

好的,我一直在@Oleg的很多答案中寻找答案,但我什么都找不到。我有一个网格,其中一个可以在线编辑,在某些字段中,我使用自动完成,当我选择某个项目时,我使用setCell,将值写入另一个字段。我的专栏模型是这样的

{ name: 'Label', index: 'Label', width: 100, align: 'Center', sorttype: "string",
    editable: true, editrules: { required: true },
    editoptions: {
        dataInit: function (elem) {
            $(elem).autocomplete({
                autoFocus: true,
                source: function (request, response) {
                    PageMethods.ObtLabels(request.term, function (data) {
                        var tiposCliente = (typeof data) == 'string' ?
                                           eval('(' + data + ')') : data;
                        response(tiposCliente);
                    }, fnLlamadaError);
                },
                minLength: 1,
                select: function (event, ui) {
                    var rowid = $('#pendientes').getGridParam('selrow');
                    **jQuery('#pendientes').setCell(rowid, 'LabelId', ui.item.id);**
                }
            });
        }
    }
},
这在编辑和添加内联时可以很好地工作,但是,当我想要添加或编辑带有表单的行时,我不能在其他字段中写入值

我不知道我的问题是否清楚。我只想在X字段中写一些东西,这取决于我在Y字段中选择的选项。所有这些都使用表单

如果有人能帮我,那就太好了

非常感谢

更新和解决方案:

我只需在代码中添加下一行:

$'inputLabelId'.valui.item.id

以及它的工作,我在LAbelId中写下所选项目的值

最后,使用autocomplete的我的专栏的el代码如下所示:

{ name: 'Label', index: 'Label', width: 100, align: 'Center', sorttype: "string",
    editable: true, editrules: { required: true },
    editoptions: {
        dataInit: function (elem) {
            $(elem).autocomplete({
                autoFocus: true,
                source: function (request, response) {
                    PageMethods.ObtLabels(request.term, function (data) {
                        var tiposCliente = (typeof data) == 'string' ?
                                           eval('(' + data + ')') : data;
                        response(tiposCliente);
                    }, fnLlamadaError);
                },
                minLength: 1,
                select: function (event, ui) {
                    var rowid = $('#pendientes').getGridParam('selrow');
                    jQuery('#pendientes').setCell(rowid, 'LabelId', ui.item.id);
                    **$('input#LabelId').val(ui.item.id);**
                }
            });
        }
    }
},

好的,我找到了答案,我只是添加了下一行

$('input#ClienteProveedor').val(ui.item.id);

这会将ui.item.id写入我想要的Y字段。

我不清楚“LabelId”列是否可编辑?您是否使用multiselect的单选模式:true?是的LabelId是可编辑的,并且它也是隐藏的…但是我已经找到了答案,我只是添加了这一行….$'inputLabelId'.valui.item.id;它的工作,我在LAbelId中写下所选项目的值。。。非常感谢!!回答