jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Validation with old and new value
This topic contains 3 replies, has 2 voices, and was last updated by nico86 9 years, 9 months ago.
-
Author
-
Hi
I try to do a validation with old and newvalue, but it seem that oldvalue is not recognize and my validation is not OKHow can create or use the oldvalue into validation part ?
Thanks{ text: 'UPGRADED',columntype: 'dropdownlist',source:stat,datafield: 'STATUSC',cellclassname: cellclass, width: 110, editable: true,filtertype: 'checkedlist', createeditor: function (row, column, editor) { editor.jqxDropDownList({ autoDropDownHeight: true, source: stat });}, cellendedit: function (row, datafield, columntype, oldvalue, newvalue) { value=newvalue; valueold=oldvalue; pat= $("#jqxgrid").jqxGrid('getcellvalue', row, 'PATIDENT'); /*VALUE OF THE FIELD NAME OF THE LINE MODIFIED */; adr= $("#jqxgrid").jqxGrid('getcellvalue', row, 'ADRNBA'); /*VALUE OF THE FIELD NAME OF THE LINE MODIFIED */; split= $("#jqxgrid").jqxGrid('getcellvalue', row, 'ROWSPLIT'); /*VALUE OF THE FIELD NAME OF THE LINE MODIFIED */; if (newvalue!=oldvalue){ $.ajax({ type : 'POST', // envoi des données en GET ou POST beforeSend : function() { // traitements JS à faire AVANT l'envoi $("#ariane").after('<span id="ajax-loader1"><img style="margin-top:26px;margin-left:-250px;height:18px;position:absolute" src="'+web_path_p+car_b+'Librairies'+car_b+'Images'+car_b+'ajax-loaderB.gif" alt="image du loader" /> </span'); }, url : 'http:'+server_sp+'/Coding/IMERIN/maj_status', // url du fichier de traitement async:false, data : '&product='+product+'&study='+study+'&expltn='+expltn+'&STATUS='+value+'&PATIDENT='+pat+'&ADRNBA='+adr+'&ROWSPLIT='+split, dataType : 'json', success : function(data){}, complete :function(data){ $('#ajax-loader1').remove(); log("Log\\maj_status.log","Update status ok : changed by "+value+" for "+pat+"/"+adr+split+""); } });}/*}*/ }, validation: function (cell, value) { alert(oldvalue); if (value=="NEW" && oldvalue=="TO BE DISCUSSED") { return { result: false, message: "New value cant be NEW if old value is equal to TO BE DISCUSSED" }; } return true; }, },
Hi nico86,
You can access the old cell value via cell parameter – cell.value.
Best Regards,
Ivailo IvanovjQWidgets Team
http://www.jqwidgets.comI try this but it doesn’t match : `if (value==”NEW” && cell.value==”TO BE DISCUSSED”) {
return { result: false, message: “New value cant be NEW if old value is equal to TO BE DISCUSSED” };
} `could you show me a litle example
Thanks
sorry, it s good for me
Thanks
-
AuthorPosts
You must be logged in to reply to this topic.