我已經成功地繪製條件語句正常網格列網格TemplateColumn中渲染條件語句[ExtJS的4.2.1]
{
header: ' ',
dataIndex: 'status_b2',
menuDisabled: true,
flex: 1,
sortable: false,
renderer : function(value, meta) {
var status = value.split("<br/>")[0];
if (status == "Unset Price"){
meta.style = "background-color:pink;";
}
else if (status == "Available"){
meta.style = "background-color:green;";
}else if (status == "Booked Unpaid"){
meta.style = "background-color:yellow;";
}else if (status == "Booked Paid"){
meta.style = "background-color:orange;";
}else if (status == "Checked In"){
meta.style = "background-color:red;";
}else if (status == "Checked Out"){
meta.style = "background-color:purple;";
}
return value;
}
我的問題是如何與TemplateColumn中電網條件邏輯呈現?如果room_status ==「髒」,我想添加背景色爲紅色。
{
text: 'Room List',
xtype: 'templatecolumn',
tpl: 'ROOM {room_number} <br/> {room_type_name} <br/> {bed_type} | {room_status}',
menuDisabled: true,
flex: 1,
sortable: false
}