Forum
Topic RSS
17:08
18/09/2010
OfflineHello,
is it possible to change edit, add, del url and mtype dynamical, or use a function?
I would like something like this:
add:true,
del:true,
search:true,
refresh:true,
}, {url : function(original_url){ return new_url; } mtype: function(original_mtype){return new mtype;}}
Or can I change parameters for form editing after add-button and so on was pressed?
Regards
Jack
01:25
10/08/2009
OfflineFirst of all you should remove comma after the refresh: "refresh:true,}" if you have the same problem in your code.
Now to your question. The requirement to use different mtype values I understend good, but having mtype absolute dynamic I don't understend.
You can overwrite url dynamicaly inside of onclickSubmit function. For example below you can find an example from one of my scripts:
jQuery("#gird").jqGrid('navGrid','#pager_id',
{edit:true, add:true, del:true, search:true, refresh:true},
{ mtype: "PUT",
onclickSubmit: function(rp_ge, postdata) {
rp_ge.url = urlEdit + '/' + postdata.list_id;
}
},
{ mtype: "POST" },
{ mtype: "DELETE",
onclickSubmit: function(rp_ge, postdata) {
rp_ge.url = urlEdit + '/' + postdata +
'?RowVersion=' + grid.getCell (postdata, 'RowVersion');
}
}
The variable urlEdit I define somewhere before. I hope you could use the example to write the code in your case.
Best regards
Oleg
12:41
10/08/2009
OfflineHi Jack,
I am glad to hear that I could help you. The RowVersion was really needed in the exmple for the optimistic locking. I took the example from the project where the data will be hold on the Microsoft SQL Server and every row in the database has additional column with the non-nullable value of the type timestamp (http://msdn.microsoft.com/en-u.....82776.aspx for details).
On every Edit operation in the jqGrid the value from the RowVersion will be send to the server automatically because the RowVersion column I defined with
hidden: true, editable: true, editrules: { edithidden: false }, hidedlg: true
option. So the value could be used for the optimistic locking. To use RowValue also in Delete operation I had to add the RowValue manualy inside of onclickSubmit as I described befor.
Best Regards
Oleg
Most Users Ever Online: 994
Currently Online:
23 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home
