jquery - jqGrid View Form DataInit -
hey (i'm looking @ oleg),
i'm looking implement similar datainit/editoptions/colmodel alternative view form.
currently, returning encrypted info in couple of columns of jqgrid, such date of birth , ssn#.
then, decrypt info when user chooses edit row, may edit decrypted version of data.
the code snippet utilize below.
editoptions:{date:true,size:"35",datainit:function(element) { $.ajax({ url: "/server/borrowers.cfc?method=decryptstring", data: {"datatype":"dob","userid":jquery('#borrowersgrid').jqgrid('getgridparam', 'selrow'),"encryptedvalue":$(element).val().trim()}, method: "post", success: function(data) { if (data.length > 1000) { $(element).val(""); } else { $(element).val(data.trim()); } } }); $(element).datepicker({dateformat: 'mm/dd/yy',changemonth:'true',changeyear:'true',yearrange:"-120:+0"}); }}
this code works well, however, user not have ability edit every row within particular grid. if permissions not high plenty edit row, given alternative view info each row.
the snippet above unfortunately not called when view form initialized, , looking similar implement view form...
what best way implement ajax phone call decrypt info view form within jqgrid?
ok, appears though existing viable solution in jqgrid 3.6.3 utilize beforeshowform event in viewoptions section of navigator...
in conclusion, move ajax phone call section of code, beneath definition of jqgrid.
note there couple of slight changes... references $(element) have been changed right selector view form, in case $("#v_dob span"). others, $("v_fieldname span").
$("#borrowersgrid").navgrid('#borrowerspager', { //navigator options }, { //edit options }, { //add options }, { //delete options }, {beforeshowform:function(form) { $.ajax({ url: "/server/borrowers.cfc?method=decryptstring", data: {"datatype":"dob","userid":jquery('#borrowersgrid').jqgrid('getgridparam', 'selrow'),"encryptedvalue":$("#v_dob span").html()}, method: "post", success: function(data) { if (data.length > 1000) { $("#v_dob span").html(""); } else { $("#v_dob span").html(data.trim()); } } }); } // view options );
jquery encryption jqgrid
No comments:
Post a Comment