jqGrid Edit - cell

jqGrid v4.6

by 1004lucifer

HTML

<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/css/ui.jqgrid.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/i18n/grid.locale-kr.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/jquery.jqGrid.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css">
<div style="height:250px;">
  <table id="list"><tr><td></td></tr></table> 
  <div id="pager"></div>
  <h4>Date, Amount, Tax 값을 변경해 보세요.</h4>
</div>

JavaScript

var serverJsonData = 
{ 
  'totalpages' : '10', 
  'currpage' : '1',
  'totalrecords' : '15',
  'invdata' : [
{'id' : '1','invdate':'cell11', 'name': '1004lucifer', 'amount' :'cell12', 'tax' :'cell13', 'total' :'1234', 'note' :'somenote'},
{'id' : '2','invdate':'cell21', 'name': '1004lucifer', 'amount' :'cell22', 'tax' :'cell23', 'total' :'2345', 'note' :'some note'},
{'id' : '3','invdate':'cell21', 'name': '1004lucifer', 'amount' :'cell22', 'tax' :'cell23', 'total' :'2345', 'note' :'some note'},
{'id' : '4','invdate':'cell21', 'name': '1004lucifer', 'amount' :'cell22', 'tax' :'cell23', 'total' :'2345', 'note' :'some note'},
  ]
};

$("#list").jqGrid({
  url: '/echo/json/', // use JSFiddle echo service
  datatype: 'json',
  mtype: 'POST',
  postData: { json: JSON.stringify(serverJsonData) },
  colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
  colModel:[
    {name:'id',index:'id', width:55},
    {name:'invdate',index:'invdate', width:90,editable:true},
    {name:'name',index:'name asc, invdate', width:100},
    {name:'amount',index:'amount', width:80, align:"right",editable:true,editrules:{number:true}},
    {name:'tax',index:'tax', width:80, align:"right",editable:true,editrules:{number:true}},    
    {name:'total',index:'total', width:80,align:"right"},    
    {name:'note',index:'note', width:150, sortable:false}    
  ],
  jsonReader : {
    root:"invdata",
    page: "currpage",
    total: "totalpages",
    records: "totalrecords",
    repeatitems: false,
    id: "0"
  },
  caption : 'JSON Data',
  height: 'auto',
  autowidth: true,
  rowNum: 5,
  forceFit : true,
  cellEdit: true,
  cellsubmit: 'clientArray',
  pager: '#pager',
  afterEditCell: function (id,name,val,iRow,iCol){
    if(name=='invdate') {
      jQuery("#"+iRow+"_invdate","#list").datepicker({dateFormat:"yy-mm-dd"});
    }
  },
  afterSaveCell : function(rowid,name,val,iRow,iCol) {
    if(name == 'amount') {
      var taxval =...