汽车
jquery 教程(jQuery EasyUI使用教程:数据网格中的列运算)

在本教程中,您将学习如何在可编辑的数据网格中包含一个运算列。计算列一般含有一个或多个其他列计算的值。

jQuery EasyUI使用教程:数据网格中的列运算nerror="javascript:errorimg.call(this);">

当用户点击一行时,我们开始一个编辑操作。

var lastIndex;
$('#tt').datagrid({
onClickRow:function(rowIndex){
if (lastIndex != rowIndex){
$(this).datagrid('endEdit', lastIndex);
$(this).datagrid('beginEdit', rowIndex);
}
lastIndex = rowIndex;
},
onBeginEdit:function(rowIndex){
var editors = $('#tt').datagrid('getEditors', rowIndex);
var n1 = $(editors[0].target);
var n2 = $(editors[1].target);
var n3 = $(editors[2].target);
n1.add(n2).numberbox({
onChange:function{
var cost = n1.numberbox('getValue')*n2.numberbox('getValue');
n3.numberbox('setValue',cost);
}
})
}
});

本站文章除注明转载外,均为本站原创或翻译


顶一下()     踩一下()

热门推荐

发表评论
0评