JqGrid Form Edit - How to post non editable field to server

I am using form edit in jqgrid. The grid has additional non-editable columns which are visible. On form editing, these fields are not to be shown but still need to be posted to server.

Any help is appreciated.

Answers


If you need to send additional information about non-editable columns which are visible I would recommend you to use onclickSubmit callback. The callback can return object which can be used to extend the data which will be send to the server on form submit. For example the following onclickSubmit implementation

onclickSubmit: function () {
    return {
        test: "bla bla"
    };
}

extend the standard data sent to the server with parameter test which value will be set to the string "bla bla".

You can do for your purpose the following:

onclickSubmit: function (options, postdata) {
    var rowid = postdata[this.id + "_id"]; // like "list_id"
    return {
        myParam: $(this).jqGrid("getCell", rowid, "colName")
    };
}

where "colName" is the value of name property of the column which you need to send.

Such approach seems to me very simple and flexible enough.


Use a hidden input?

<input type="hidden" name="foo" value="bar">


or u can set editable false in jqgrid colModel property

{ name: 'pID', index: 'pID', width: 50, editable: false, sortable: false }

Need Your Help

Watermark Outside The image in PHP?

php watermark

I would like to upload an image, and then automatically add a watermark (text or image), but not over the image, I want it outside the image, How can I do this with PHP? and at the same time if the...