程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> 合計行樣式-datagrid 如何設置合計行的顏色

合計行樣式-datagrid 如何設置合計行的顏色

編輯:編程綜合問答
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":"合計:"}]}

最佳回答:


改變所有合計行的方法我現在還是沒有找到現在才去折中的方式,只改變合計兩個字的 顏色,代碼如下:
columns : [ [
{
field : 'WARENO',
title : '貨號',
width : 20,
align : 'center',
halign : 'center',
styler: function(value,row,index){
if (value =="合計"){
return 'color:#FF7900';
}
}
}]]

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved