u010474082 2016-01-17 23:18 采纳率: 40%
浏览 2346
已采纳

datagrid 如何设置合计行的颜色

$('#xs').datagrid(
{
idFile : 'WARENAME',
width : '98%',
fitColumns : true,
striped : true, //隔行变色
singleSelect : true,
showFooter : true,
columns : [ [
{
field : 'WARENAME',
title : '商品',
width : 20,
align : 'center',
halign : 'center',
styler: function(value,row,index){
if (value =="合计:"){
return 'color:#F89134';
}
}
}, {
field : 'AMOUNT',
title : '数量',
width : 20,
align : 'center',
halign : 'center'
}, {
field : 'CURR',
title : '金额',
width : 20,
align : 'center',
halign : 'center'
} ] ],
onClickRow : function(rowIndex, rowData) {

                }
            });




            function gethouseworktotal(){
    datagridtab();
    $.ajax({
        type : "POST", //访问WebService使用Post方式请求 
        url : "ChangeClassServlet", 
        data : {
            changeclassser : "houseworktotal",
            classid:classid
        },                           
        dataType : 'text',
        success : function(text) { //回调函数
            if (isSucess(text)) {
                var data = $.parseJSON(text);
                var XSLIST = {'total':1,'rows':data.XSLIST,"footer":data.XSLIST1}; 
                $('#xs').datagrid('loadData', XSLIST);
            } 
        }
    });
}
json:
{"CURRQC":"0","CURRYE":"12390","CURRSJYE":"12390","CURRYH":"0","CURRJC":"12390","CURRYK":"0","XSLIST":[{"WAREID":"1","WARENAME":"上衣","WARENO":"3001","UNITS":"件","AMOUNT":"3","CURR":"1440"},{"WAREID":"2","WARENAME":"大衣","WARENO":"3002","UNITS":"件","AMOUNT":"9","CURR":"7700.60"},{"WAREID":"4","WARENAME":"西便装","WARENO":"30041","UNITS":"件","AMOUNT":"4","CURR":"3600"},{"WAREID":"5","WARENAME":"T恤","WARENO":"3005","UNITS":"件","AMOUNT":"8","CURR":"2800"},{"WAREID":"21","WARENAME":"牛仔裤","WARENO":"3006","UNITS":"条","AMOUNT":"1","CURR":"280"}],"XSLIST1":[{"CURR":"15820.6","AMOUNT":"25","WARENAME":"合计:"}]}

展开全部

  • 写回答

7条回答 默认 最新

  • u010474082 2016-02-22 22:47
    关注

    改变所有合计行的方法我现在还是没有找到现在才去折中的方式,只改变合计两个字的 颜色,代码如下:
    columns : [ [
    {
    field : 'WARENO',
    title : '货号',
    width : 20,
    align : 'center',
    halign : 'center',
    styler: function(value,row,index){
    if (value =="合计"){
    return 'color:#FF7900';
    }
    }
    }]]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)
编辑
预览

报告相同问题?

悬赏问题

  • ¥50 怎么获取Ace Editor中的python代码后怎么调用Skulpt执行代码
  • ¥30 fpga基于dds生成幅值相位频率和波形可调的容易信号发生器。
  • ¥15 R语言shiny包和ncdf4包报错
  • ¥15 origin绘制有显著差异的柱状图和聚类热图
  • ¥20 simulink实现滑模控制和pid控制对比,提现前者优势
  • ¥30 开发一款闲置物资借用管理软件
  • ¥15 (有偿)1500/怎么让网络延迟网速不变/需要做成软件/
  • ¥15 空调变频器板怎么测试可靠性和性能
  • ¥15 uniapp开发:微信小程序使用drawImage绘制第二次时不生效?
  • ¥500 tdx winner 函数计算公式,需和官方一样,1000元