您的位置:首页 > Web前端 > BootStrap

Bootstrap Table 实现列格式化显示

2018-01-15 17:58 302 查看
格式化使用函数formatter

例如:

formatter: function (value, row, index) {
if (value == 'en') {
return "英语";
} else {
return "中文";
}
}


详细使用如下:

var $table = $('#table').bootstrapTable({
url: '/fnd/message/query',
height: 460,
method: 'post',
search: true,
locale: 'zh-CN',
pagination: true,
sidePagination: 'server', // client or server
pageList: [10, 25, 50, 100],
showColumns: true,
showRefresh: true,
sortable: true,
contentType: 'application/x-www-form-urlencoded',
queryParams: queryParams,
toolbar: '#toolbar-btn',
columns: [{
field: 'state',
checkbox: true,
}, {
field: 'messageCode',
title: '<@spring.message "fnd.message_code"/>',
sortable: true,
width: 300,
editable: true
}, {
field: 'langCode',
title: '<@spring.message "fnd.lang_code"/>',
width: 150,
align: 'center',
editable: {
type: 'text',
title: '<@spring.message "fnd.lang_code"/>',
validate: function (v) {
if (!v) return '语言不能为空';

}
},
formatter: function (value, row, index) { if (value == 'en') { return "英语"; } else { return "中文"; } }
}, {
field: 'messageText',
title: '<@spring.message "fnd.message_text"/>',
editable: true
},],
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: