wenzhixin bootstrap-table 根据data大小自动标红
需求是,有些数据低于标准时需要标红
思路:待table加载成功后,选取特定列,获取data判断并添加样式
代码如下,转载请注明
$('table').on('load-success.bs.table', function (data) { $("table tr td:nth-child(3)").each(function () { // $(this)['0'].className = 'success'; if (parseInt($(this)['0'].innerText) < 100){ $(this)['0'].className = 'danger'; } }); });
解释:
用jquery selector选择表的所有第三列,判断大小并添加样式
sort of, I have some experience in the domain of database(MySQL/mongo), java, python, front-end, etc. I'll willing to give and accept bits of help from others.
now base in Singapore.