Steve Dyke
Steve Dyke

Reputation: 175

Sending Current Cell Value in dataURL

Using jqGrid 4.15.6-pre - free jqGrid

In my colModel I am populating a cell with 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.

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
                });
        }}},

Upvotes: 0

Views: 53

Answers (1)

Tony Tomov
Tony Tomov

Reputation: 3277

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. In order to do what you want you will need to use a dataUrl as function and pass the value to it like this:

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
                });
        }}},

Upvotes: 1

Related Questions