bootstrapTable設置行樣式(背景顏色)


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; }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM