【文件属性】:
文件名称:jquery easyui 行编辑
文件大小:2KB
文件格式:TXT
更新时间:2021-06-26 11:30:08
jquery easyu
function endEditing(){
if (editIndex == undefined){return true}
if ($('#prodgEdit').datagrid('validateRow', editIndex)){
$('#prodgEdit').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
function accept(){
if (endEditing()){
$('#prodgEdit').datagrid('acceptChanges');
}
}
function reject(){
$('#prodgEdit').datagrid('rejectChanges');
editIndex = undefined;
}
$('#prodgEdit').datagrid({
rownumbers: true,
autoSave: true,
onClickRow:function(index){
if (editIndex != index){
if (endEditing()){
$('#prodgEdit').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#prodgEdit').datagrid('selectRow', editIndex);
}
}
},
onAfterEdit:function(){
var total = calTotalValue();
$("#vatValue").textbox("setValue", total);
}
});
function setEditing(rowIndex){
var editors = $('#prodgEdit').datagrid('getEditors', rowIndex);
var priceEditor =editors[0];
var amountEditor = editors[1];
var count = $(priceEditor.target);
var price = $(amountEditor.target);
}
function calTotalValue(){
var rows = $('#prodgEdit').datagrid('getRows');
var total = 0;
for(var i=0,l=rows.length;i