bootstrap中table给行如何加背景色-创新互联
小编给大家分享一下bootstrap中table给行如何加背景色,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

bootstrap table给行怎么加背景色
bootstrap table定义代码:
$table.bootstrapTable({
showExport: true,
height: 540,
rowStyle:rowStyle,//通过自定义函数设置行样式
columns: [
{
field: 'id',
title: '序号',
align: 'center',
sortable: true
}, {
field: 'sid',
title: '学号',
align: 'center'
},
]
});bootstrapTable设置行样式(背景颜色)函数1:通过调用bootstrap默认的样式来设置指定行的背景颜色
function rowStyle(row, index) {
var classes = ['active', 'success', 'info', 'warning', 'danger'];
if (index % 2 === 0 && index / 2 < classes.length) {
return {
classes: classes[index / 2]
};
}
return {};
}bootstrapTable设置行样式(背景颜色)函数2:调用自定义样式设置指定行的字体颜色
function rowStyle(row, index) {
var style = {};
style={css:{'color':'#ed5565'}};
return style;
}看完了这篇文章,相信你对bootstrap中table给行如何加背景色有了一定的了解,想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
名称栏目:bootstrap中table给行如何加背景色-创新互联
网站URL:http://www.scyingshan.cn/article/dhccpj.html


咨询
建站咨询
