javascript - How to allow numbers only in jqGrid cell editing? -
javascript - How to allow numbers only in jqGrid cell editing? -
when grid editable take numbers when typing how it?
jsp grid load code:
<s:url id="mobbillid" action="newmul_mob_gridact" />        <sjg:grid caption="employee mobilebill details"               gridmodel="mobbill_gridmodel"                height="200"               href="%{mobbillid}"               id="gridtab"               celledit="true"               cellurl="%{mobbillid}"                             rownumbers="true"               viewrecords="true"               pager="true"               pagerposition="center"               navigator="true"               navigatorsearch="true"               navigatorsearchoptions="{multiplesearch:true}"               navigatordelete="false"               navigatoredit="false"               loadonce="true"               rownum="10000"               multiselect="true"               reloadtopics="reloadsearchedclaims"               footerrow="false"               userdataonfooter="true"               onselectrowtopics="rowselect"             >         <sjg:gridcolumn name="newsin_mob_faname" index="newsin_mob_faname" title="facode" width="100" />         <sjg:gridcolumn name="newsin_mob_name" index="newsin_mob_name" title="faname" width="100" />         <sjg:gridcolumn name="newsin_mob_no" index="newsin_mob_no" title="mobno" width="100" />         <sjg:gridcolumn name="newsin_mob_billno" index="newsin_mob_billno" title="billno" width="40" editoptions="true" editable="true"  />         <sjg:gridcolumn name="newsin_mob_billamt" index="newsin_mob_billamt" title="billamt" width="90" editable="true" />         <sjg:gridcolumn name="newsin_mob_othchrg" index="newsin_mob_othchrg" title="othchrg" width="95" editable="true" />         <sjg:gridcolumn name="newsin_mob_psts" index="newsin_mob_psts" title="refid" width="70" align="right"  hidden="true"/>         <sjg:gridcolumn name="newsin_mob_rmrk" index="newsin_mob_rmrk" title="remark" width="75" align="right"  editable="true"/>         <sjg:gridcolumn name="newsin_mob_opnbal" index="newsin_mob_opnbal" title="opnbal" width="75" align="right" hidden="true"/>         </sjg:grid>         
you can utilize jquery handle this, check fiddle out : http://jsfiddle.net/yrshaikh/44pc78pj/
you have editable textboxes have class called .allownumericwithdecimal ,  utilize below code
 $(".allownumericwithdecimal").on("keypress keyup blur",function (event) {      $(this).val($(this).val().replace(/[^0-9\.]/g,''));             if ((event.which != 46 || $(this).val().indexof('.') != -1) && (event.which < 48 || event.which > 57)) {                 event.preventdefault();             }         });    if textboxes of grid added dynamically need this
$(document).on('keypress keyup blur', '.allownumericwithdecimal', function () {     $(this).val($(this).val().replace(/[^0-9\.]/g, ''));     if ((event.which != 46 || $(this).val().indexof('.') != -1) && (event.which < 48 || event.which > 57)) {         event.preventdefault();     } });        javascript jsp jqgrid 
 
  
Comments
Post a Comment