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
Adding addition value to POST fails
15/04/2014
18:44
Avatar
rickyRoszak
Member
Members
Forum Posts: 3
Member Since:
15/08/2012
sp_UserOfflineSmall Offline

I am trying to add an additional value to the POST I send after editing a row.  The editable column values all show up in the request when I check in the servlet but 'empId' which is not editable does noit show up.  I tried adding it with editData and have had no luck.  The code is below:

<!DOCTYPE html>

<html>

<head>

<title>jqGrid Template</title>

<link rel="stylesheet" href="css/jquery.ui.theme.css" />

<link rel="stylesheet" href="css/ui.jqgrid.css" />

<script src="js/jquery.js"></script>

<script src="js/grid.locale-en.js"></script>

<script src="js/jquery.jqGrid.min.js"></script>

</head>

<body>

<table id="grid"></table>

<div id="pager"></div>

<script>

$("#grid").jqGrid({

datatype: "json",

url: "LoadJsonDataServlet?type=BS21 7RH",

pager: "#pager",

mType: 'POST',

colModel:[

{name:'empId', width:100, editable:false},

{name:'firstName',width:100, editable:true},

{name:'lastName', width:100, editable:true},

{name:'address', width:500, editable:true}

],

editurl: "UpdateDataServlet"

});

$("#grid").jqGrid("navGrid", "#pager",

{ add: true,

edit: true,

del: false,

search: false,

refresh: false,

edit : {

addCaption: "Add Record",

editCaption: "Edit Record",

bSubmit: "Submit",

bCancel: "Cancel",

bClose: "Close",

saveData: "Data has been changed! Save changes?",

bYes : "Yes",

bNo : "No",

bExit : "Cancel",

editData:{

EmpId: function(){

var sel_id = $("#grid").jqGrid("getGridParam", 'selrow');

var value = $("#grid").jqGrid("getCell", sel_id, 'empId');

return value;

}

}

}

},

{recreateForm: true,

closeAfterEdit: true,

modal:true}

);

</script>

</body>

</html>

16/04/2014
12:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

editData is a option where you add a values usually only once when the formeditiong is initialized.

In your case you will need to use serializeEditData  event in for editing. See the doc.

This should look something like this:

$("#grid").jqGrid("navGrid", "#pager",

{ add: true,

edit: true,

del: false,

search: false,

refresh: false,

// edit

{

serializeEditData : function(postdata) {

// calculate the id and do

postdata.EmpID = value;

return postdata;

}

}

...

);

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:
45 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