jqgrid delete: not getting value

后端 未结 1 490
时光取名叫无心
时光取名叫无心 2021-01-27 20:52

I developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10).

I am using JQGRID to display data in tabular format. I also want

相关标签:
1条回答
  • 2021-01-27 21:35

    You use protID in the url in the wrong way. The value of url option used for Delete operation will be set once during executing of the call of navGrid. At the moment you not yet set any value for the variable protID. You can fix the code you can use one from the following ways: onclickSubmit, delData, beforeSubmit or serializeDelData.

    I am wounder a little that you use mtype: 'GET' option for delete operation. Typically one use HTTP POST or HTTP DELETE in the case. If you really need mtype: 'GET' you can replace

    {
        mtype: 'GET',
        url: 'ProtocolJGridServChildStages?action=protocolStageDelete&protID=' + protID
    }
    

    parameter of navGrid to

    {
        mtype: 'GET',
        url: 'ProtocolJGridServChildStages',
        delData: {
            action: 'protocolStageDelete',
            protID: function () {
                return protID;
            }
        }
    }
    

    or alternatively

    {
        mtype: 'GET',
        url: 'ProtocolJGridServChildStages',
        onclickSubmit: function (options, rowid) {
            var rowData = jQuery(this).jqGrid('getRowData', rowid);
            return {
                action: 'protocolStageDelete',
                protID: ret.PROTOCOL_ID
            };
        }
    }
    

    If you do consider to use mtype other as GET, but will need to set protID as part of URL you can modify url option dynamically inside of onclickSubmit or beforeSubmit callback. For example

    {
        mtype: 'GET',
        onclickSubmit: function (options, rowid) {
            var rowData = jQuery(this).jqGrid('getRowData', rowid);
            options.url = 'ProtocolJGridServChildStages?' + jQuery.param({
                action: 'protocolStageDelete',
                protID: ret.PROTOCOL_ID
            });
        }
    }
    

    You can choose yourself the way which better corresponds your requirements.

    0 讨论(0)
提交回复
热议问题