第一步:定义对象存放列内容;
var colummvalue=[];
colummvalue.push([{
field: 'selectItem',
title: '',
width: '36px',
radio: true,
visible: true
},
{
field: 'col2',
title: '科目',
align: 'center',
colspan: '2'
},
{
field: 'col3',
title: '期初余额',
align: 'center',
colspan: '2'
},
{
field: 'col4',
title: '本期发生',
align: 'center',
colspan: '2'
},
{
field: 'col5',
title: '期末余额',
align: 'center',
colspan: '3'
}],
[{
field: 'selectItem',
title: '',
width: '36px',
radio: true
},
{
field: 'itembm',
title: '科目编码',
width: '60'
},
{
field: 'kmmc',
title: '科目名称',
align: 'center',
width: '260px',
},
{
field: 'jfje0',
title: '借方',
align: 'center',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
},
{
field: 'dfje0',
title: '贷方',
align: 'center',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
},
{
field: 'jfje',
title: '借方',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
},
{
field: 'dfje',
title: '贷方',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
},
{
field: 'jfje2',
title: '借方',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
},
{
field: 'dfje2',
title: '贷方',
align: 'center',
tbalign: 'right',
footerFormatter: function (value) {
return toformats(value);
}
}
]);
第二步:引用上面的对象colummvalue
$('#gridTable').ysTable({
method: 'get',
url: urls,
dataType: "text",
contentType: 'application/json',
pageNumber: 1, //初始化加载第一页
pagination: true,//是否分页
sidePagination: 'client',//server:服务器端分页|client:前端分页
//pageSize: 4,//单页记录数
pageList: [5, 10, 15, 20, 30],//可选择单页记录数
showRefresh: true,//刷新按钮
showFooter: true, //开启底部
queryParams: function (params) {//上传服务器的参数
var temp = {
Value1: encodeURIComponent(bTest),
};
return temp;
},
responseHandler: function (data) {
data = JSON.parse(Decrypt(data) + "");
console.log(data);
return data;
},
columns: colummvalue,
onLoadSuccess: function (obj) {
//tfootertab("gridTable");//底部设置
},
onLoadError: function (data) {
//console.log(data);
}
});