easyui动态编辑,并改变单元格值

onBeginEdit:function(index,data){
				debugger;
				
				var editor = $("#datagrid"+i).datagrid("getEditor",{index:index,field:'unitPrice'});
				editor.target.numberbox({onChange:function(newVal,oldVal){
					var datas = $("#datagrid"+i).datagrid('getRows')[index];
					var totals = newVal*datas.times*datas.amount;
					//更新行数据
					$("#datagrid"+i).datagrid("updateRow",{index :index,row:{total:totals,unitPrice:newVal}});
				}});
				
				var editor2 = $("#datagrid"+i).datagrid('getEditor',{index:index,field:'remark'});
				//失去焦点结束行编辑
				editor2.target.bind('blur',function(old,newVal){
					$("#datagrid"+i).datagrid("endEdit",index);
				});
				
			},

你可能感兴趣的:(前端)