代码示例001:Grid背景色与字体颜色

Grid背景色设置

'Background-Color:' + if(types='0', 'white', 
    if(types='1', 'red', 
        if(types='2', 'yellow', 
            if(types='3', 'skyblue', 
                if(types='4', 'sandybrown', 
                    if(types='5', 'pink', 'white'))))))

Grid行字体颜色设置

'color:'+
if(IsSeller = 'Y','Red',
'Black')

控制代码: 


//采购记录待使用确认 - 全选 
function uf_selectAll(){ 
    tmpRec = 0;
    tmpNum = 0;
    tmpTaxAmount = 0;
    tmpCostAmt = 0;
	if (grid1.dataset.recordCount > 0){
		for (var i = 0;i < grid1.dataset.recordCount;i++){
			grid1.dataset.setValueAt(i, "IsSeller", 'Y');
			tmpRec++;
			tmpNum += grid1.dataset.getValueAt(i,"Num");
			tmpTaxAmount += grid1.dataset.getValueAt(i,"TaxAmount");
			tmpCostAmt += grid1.dataset.getValueAt(i,"TaxAmount");
		} 
		dsRkmx.update();
		dsRkmx.updateGrid();
    }
    label18.setHTML(tmpRec.toString());
    label19.setHTML(tmpNum.toLocaleString());
    label20.setHTML(tmpTaxAmount.toLocaleString());
    label21.setHTML(tmpCostAmt.toLocaleString());      
}

//采购记录待使用确认 - 全不选
function uf_selectNone(){ 
    tmpRec = 0;
    tmpNum = 0;
    tmpTaxAmount = 0;
    tmpCostAmt = 0;
	if (grid1.dataset.recordCount > 0){
		for (var i = 0;i < grid1.dataset.recordCount;i++){			
			grid1.dataset.setValueAt(i, "IsSeller", 'N'); 
		}  		
		dsRkmx.update();
		dsRkmx.updateGrid();
    }
    label18.setHTML(tmpRec.toString());
    label19.setHTML(tmpNum.toLocaleString());
    label20.setHTML(tmpTaxAmount.toLocaleString());
    label21.setHTML(tmpCostAmt.toLocaleString());  
}

//采购记录待使用确认 - 返选
function uf_selected(){
    tmpRec = 0;
    tmpNum = 0;
    tmpTaxAmount = 0;
    tmpCostAmt = 0;
	if (grid1.dataset.recordCount > 0){
		for (var i = 0;i < grid1.dataset.recordCount;i++){
			if(grid1.dataset.getValueAt(i,"IsSeller") =="Y"){
				grid1.dataset.setValueAt(i, "IsSeller", 'N');
			}else{
				grid1.dataset.setValueAt(i, "IsSeller", 'Y');
				tmpRec++;
				tmpNum += grid1.dataset.getValueAt(i,"Num");
				tmpTaxAmount += grid1.dataset.getValueAt(i,"TaxAmount");
				tmpCostAmt += grid1.dataset.getValueAt(i,"TaxAmount");			
			}
		} 
		dsRkmx.update();
		dsRkmx.updateGrid();
    }
    label18.setHTML(tmpRec.toString());
    label19.setHTML(tmpNum.toLocaleString());
    label20.setHTML(tmpTaxAmount.toLocaleString());
    label21.setHTML(tmpCostAmt.toLocaleString());
}

//采购记录待使用确认 - 双击选择
function uf_DbClieck(){
	dsRkmx.edit();
	if(dsRkmx.field("IsSeller").value == "Y"){
	    tmpRec -= 1;
	    tmpNum -= dsRkmx.field("Num").value;
	    tmpTaxAmount -= dsRkmx.field("TaxAmount").value;
	    tmpCostAmt -= dsRkmx.field("TaxAmount").value;
	    dsRkmx.field("IsSeller").value = "N";
	}else{
	    tmpRec += 1;
	    tmpNum += dsRkmx.field("Num").value;
	    tmpTaxAmount += dsRkmx.field("TaxAmount").value;
	    tmpCostAmt += dsRkmx.field("TaxAmount").value;
	    dsRkmx.field("IsSeller").value = "Y";
	}	
	dsRkmx.update();
	dsRkmx.updateGrid();
    label18.setHTML(tmpRec.toString());
    label19.setHTML(tmpNum.toLocaleString());
    label20.setHTML(tmpTaxAmount.toLocaleString());
    label21.setHTML(tmpCostAmt.toLocaleString());
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值