grid复选框事件以及复选框选中合计计算和显示

前台复选框选中合计及显示:
grid.attachEvent("onEditCell",doOnCellEdit) 
				grid.headerCheckBoxCallback(getTotal);

function doOnCellEdit(stage,rowId,cellId) {
			     	if((cellId==1 && stage==1)) {
						getTotal();
			     	}
			     	return true;
				}
				function getTotal() {
					var ary = grid.colsToArray("5"," C1 =='1' ");
					var totalAmount = 0;
				    for(var i=0; i<ary.length; i++) {	    	
				      totalAmount = Number(ary[i]) + totalAmount;
				    }
				 skysz.$("audit.book.receiptDetail.grid"+"aggValuesPanel0").innerHTML= '<span>金额合计:'+Number(totalAmount).toFixed(2)+'</span>' ;
				}


后台计算合计并显示:
grid.setAggValuesHeader("金额合计 ");


		Double totalAmount=0.00d;
		List<Object[]> list=arrayGrid.getData();
		if(CollectionUtils.isNotEmpty(list)){
			for(Object[] obj:list){
				totalAmount+=Double.parseDouble(obj[5].toString());
			}
		}
		pageHandler.addAggValue(totalAmount);

你可能感兴趣的:(金额合计显示,复选框选中事件)