效果
实战
1、字段如下
, cols: [[ //表头
{
field: 'id', title: 'ID', width: 60, sort: false, fixed: 'left'}
, {
field: 'title', title: '标题', width: 180}
, {
field: 'authorName', title: '作者', width: 80, sort: false}
, {
field: 'category', title: '分类', width: 100, sort: false}
, {
field: 'tags', title: '标签', width: 100, sort: false}
, {
field: 'viewCount', title: '浏览量', width: 90, sort: true}
, {
field: 'commentCount', title: '评论数', width: 90, sort: true}
, {
field: 'canComment', title: '评论开关', width: 90, sort: false}
, {
field: 'putTop', title: '置顶', width: 80, sort: true}
, {
field: 'status', title: '状态', width: 80, sort: true}
, {
field: 'createTime', title: '发布时间', width: 170, sort: true}
, {
title: '操作', minWidth: 50, templet: '#currentTableBar', fixed: "right", align: "center"}
]]
其中,putTop
、canComment
、status
使用的Integer
格式,前端需求是展示中文
2、根据需求更改
, done: function (res, curr, count) {
// 对应putTop字段
$("[data-field = 'putTop']").children().each(function () {
if ($(this).