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

Bottom Space to: UIView Constraint

ios uiview interface-builder storyboard autolayout

Boy am I lost with this one. I have two UIViews "TopView" and "BottomView". This is used to have a slide out menu when activated. I have a simply UILabel at the bottom of the page which has a copyr...

Jquery window height messed up

jquery ruby-on-rails firefox firebug

I'm using the jquery-rails 2.2.1 with the jquery 1.9.1

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.