Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Hidden value not post after i change value of that field
30/03/2012
09:08
Avatar
adit.sheth
New Member
Members
Forum Posts: 2
Member Since:
30/03/2012
sp_UserOfflineSmall Offline

Hi I am new in jqgrid .

I am having a problem on posting data of hidden field when i changed it at the time of edit.

Below is my code. I use autocomple to change Country. When i change country i am going to change countryid. I inspect in firebug it is changed but when i am going to save i will not post country id.

If i save without changing value of country i got country id.  

jQuery("#DemoGrid").jqGrid({

url: '<%:Url.Action("DemoList","DemoController")%>',

editurl: '<%: Url.Action("DemoAction", "DemoController")%>',

mtype: 'POSt',

datatype: 'json',

page: 1,

colNames: ["Actions", "DemoID", "CountryID", "Country"],

colModel: [ { "sortable": false, "formatoptions": { "editbutton": true, "delbutton": true, "keys": false }, "width": 50, "search": false, "formatter": "actions", "name": "", "index": "" },

{ "width": 0, "hidden": true, "key": true, "search": false, "name": "DemoID", "index": "DemoID" },

{ "search": false, "hidden": true,"editable": true, "editrules": { "edithidden": false },"index": "CountryID", "width": 30, "name": "CountryID" },

{ "editoptions": { dataInit: function (el) { setTimeout(function () { var ec = 'AutoComplete'; var rowid = jQuery('#DemoGrid').getGridParam('selrow'); jQuery(el).autocomplete({ source: '<%: Url.Action("CountryAutoComplete", "DemoController")%>', minLength: 1, select: function (event, ui) { event.preventDefault(); if (ui.item.value != 0) { jQuery(el).val(ui.item.title); jQuery('#DemoGrid').jqGrid('setCell', rowid, 'CountryID', ui.item.value); } }, focus: function (event, ui) { event.preventDefault(); if (ui.item.value != 0) { jQuery(el).val(ui.item.title); } } }).data("autocomplete")._renderItem = function (ul, item) { if (item.value == 0) jQuery('#DemoGrid').jqGrid('setCell', rowid, 'CountryID', 0); return jQuery(" ") .data("item.autocomplete", item) .append("" + item.title + "") .appendTo(ul) }; }, 200); } }, "editable": true, "index": "Country", "search": true, "name": "Country", "edittype": "text" }],

viewrecords: true,

scrollrows: false,

prmNames: { id: "DemoId" },

shrinkToFit: false,

pager: jQuery('#DemoGrid_pager'),

altRows: true,

rowNum: 10,

rowList: [10, 20, 30],

jsonReader: { id: "DemoId" },

sortname: 'DemoId',

sortorder: 'desc',

width: '530',

height: '227',

viewsortcols: [false, 'vertical', true] }).navGrid('#DemoGrid_pager', { "edit": false, "add": false, "del": false, "search": false, "refresh": true, "view": false, "position": "left", "cloneToTop": true });

jQuery("#DemoGrid").jqGrid('inlineNav', '#DemoGrid_pager', { edit: false, add: true }); jQuery("#DemoGrid").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true }); });

Thanks a lotSmile

05/04/2012
16:10
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

You have hidden:true and and edithidden ; false - this field at all is not present in the grid form.

Moreover hidden fields are not posted to the server.

I sugest you a very simple approach - set the field as hidden - in edit rules set it as edithidden to true.

In beforeShowForm event hide the filed like this

$("#tr_CountryID).hide();

Look at documentationn what for id are builded automatically in the form.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information