EasyUI Datagrid 数据网格,动态生成table,合计一列数据

EasyUI Datagrid 数据网格


动态生成table,合计一列数据

例如:在span4中显示出权重的总和

<th data-options="field:'---',width:1000,colspan:2">权重合计:
	<span id="span4"></span>
</th>
var weight_total=0;//权重合计
onLoadSuccess : function() {
	$("#span4").html(weight_total+"%"); //权重合计
}
//权重合计
rowStyler: function(index,row){																		
	weight_total+=parseInt(row.weights);
	//alert(weight_total);	
}

parseInt() 函数可解析一个字符串,并返回一个整数。

rowStyler:function(index,row){}
返回例如 'background:red' 的样式。
该函数需要两个参数:
rowIndex:行的索引,从 0 开始。
rowData:该行相应的记录。

代码实例:

$('#dg').datagrid({
	rowStyler: function(index,row){
		if (row.listprice>80){
			return 'background-color:#6293BB;color:#fff;'; // return inline style
			// the function can return predefined css class and inline style
			// return {class:'r1', style:{'color:#fff'}};	
		}
	}
});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值