简体   繁体   English

在 dataURL 中发送当前单元格值

[英]Sending Current Cell Value in dataURL

Using jqGrid 4.15.6-pre - free jqGrid使用 jqGrid 4.15.6-pre - 免费 jqGrid

In my colModel I am populating a cell with dataURL.在我的 colModel 中,我用 dataURL 填充了一个单元格。 I want to send the current cell value to the server with the URL. The following sends the parameter but the value(this.value) is undefined.我想使用 URL 将当前单元格值发送到服务器。以下发送参数但值(this.value)未定义。

colModel:[
        {name:'id', index:'id', width:80, hidden: true, editable: true, editoptions:{ readonly:'readonly'}, editrules:{edithidden:true}, formoptions:{rowpos:1, colpos:1,label:"Index#:"}},
        {name:'crrstatus', index:'crrstatus', hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:2, colpos:1,label:"Current Queue:", elmsuffix: " "},
         edittype: "select",
            editoptions: { dataUrl: '/QMSWebApp/CustomerReturnRecordsControllerServletV8?lifecycle=customerReturnStatusOptionsLessInitialized&currentQueue='+this.value,
            selectFilled: function (options) {
                $(options.elem).select2({
                    dropdownCssClass: 'ui-widget ui-jqdialog zclassX2',
                    width: 300
                });
        }}},

You can not do it this way in jqGrid (suppose free-jqgrid too), since the this.value is set when the colModel is created and it is undefined to this time.你不能在 jqGrid 中这样做(假设 free-jqgrid 也是如此),因为this.value是在创建 colModel 时设置的,并且此时它是未定义的。 In order to do what you want you will need to use a dataUrl as function and pass the value to it like this:为了做你想做的事,你需要使用 dataUrl 作为 function 并将值传递给它,如下所示:

colModel:[
        {name:'id', index:'id', width:80, hidden: true, editable: true, editoptions:{ readonly:'readonly'}, editrules:{edithidden:true}, formoptions:{rowpos:1, colpos:1,label:"Index#:"}},
        {name:'crrstatus', index:'crrstatus', hidden: true, editable: true, editrules:{edithidden:true}, formoptions:{rowpos:2, colpos:1,label:"Current Queue:", elmsuffix: " "},
         edittype: "select",
            editoptions: { dataUrl: function ( rowId, value, name) {
                return '/QMSWebApp/CustomerReturnRecordsControllerServletV8?lifecycle=customerReturnStatusOptionsLessInitialized&currentQueue='+value,
            }
            selectFilled: function (options) {
                $(options.elem).select2({
                    dropdownCssClass: 'ui-widget ui-jqdialog zclassX2',
                    width: 300
                });
        }}},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM