是否可以根據數據單元的值更改行類(使用引導程序)? 事情是這樣的: (這裏我硬編碼類成排) 根據單元格的值更改表格的行類
這裏是代碼
onEachFeature: function (feature, layer) {
if (feature.properties) {
var content = "<table class='table table-striped table-bordered table-condensed'>" + "<tr><th>Šifra trafostanice</th><td>" + feature.properties.ts_sifra +
"</td></tr>" + "<tr><th>Name</th><td>" + feature.properties.ts_naziv + "</td></tr>" +
"<tr><th>Code</th><td>" + feature.properties.sifra_lampe + "</td></tr>" +
"<tr><th>Power</th><td>" + feature.properties.tip_lampe + "</td></tr>" +
"<tr><th>Pole type</th><td>" + feature.properties.vrsta_stupa + "</td></tr>" +
"<tr><th>Adress</th><td>" + feature.properties.adresa + "</td></tr>" +
"<tr><th>Services</th><td>" + feature.properties.datum + "</td></tr>"
"</table>";.....
所以,我的問題是可以根據數據值更改行的類別嗎?
(例如果錶行服務的價值「的Nema servisa」添加類 成功別的假行保持不變)
是的,這有效的,簡潔答案, 謝謝!我甚至調整了一下,添加這行代碼feature.properties.datum ==='Nema servisa'? 'class =「danger」':''|| feature.properties.datum!='Nema servisa'? 'class =「success」':'' – Svinjica