Forum
Topic RSS
22:21
27/02/2013
OfflineThe checkValues function currently passes the value and column label, but in my case I have several columns with the same label, but different names and ids, which need to validate against another column depending on the name of the column to be validated. So I propose the following change to checkValues to pass the column name in addition to the column label:
checkValues : function(val, valref,g, customobject, nam) {
- var edtrul,i, nm, dft, len;
+ var edtrul,i, nm, dft, len, colnm;
if(customobject === undefined) {
if(typeof valref==='string'){
for( i =0, len=g.p.colModel.length;i<len; i++){
@@ -6093,6 +6093,7 @@
}
if(edtrul) {
if(!nm) { nm = g.p.colNames[valref]; }
+ colnm = g.p.colModel[valref].name;
if(edtrul.required === true) {
if( $.jgrid.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; }
}
@@ -6147,7 +6148,7 @@
if(edtrul.custom === true) {
if( !(rqfield === false && $.jgrid.isEmpty(val)) ) {
if($.isFunction(edtrul.custom_func)) {
- var ret = edtrul.custom_func.call(g,val,nm);
+ var ret = edtrul.custom_func.call(g,val,nm, colnm);
return $.isArray(ret) ? ret : [false,$.jgrid.edit.msg.customarray,""];
}
return [false,$.jgrid.edit.msg.customfcheck,""];
09:51
Moderators
30/10/2007
OfflineHello,
Thanks. Good idea, but I want to add not so much code and do more things.
So I added the valref as parameter to the custom_func.
In your code your code to get the name from colmodel you just do
custom_func : function( val, label, colIndex) {
...
var colnm = this.p.colModel[colIndex].name;
...
}
Hope this is more usefull.
Thanks
Tony
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.
Most Users Ever Online: 994
Currently Online:
96 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