$('#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":"合计:"}]}