【发布时间】:2014-06-12 16:53:24
【问题描述】:
我已经成功在普通网格列上渲染条件语句
{
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;
}
我的问题是如何在模板列网格上使用条件逻辑进行渲染?如果 room_status == "Dirty",我想将背景颜色添加为红色。
{
text: 'Room List',
xtype: 'templatecolumn',
tpl: 'ROOM {room_number} <br/> {room_type_name} <br/> {bed_type} | {room_status}',
menuDisabled: true,
flex: 1,
sortable: false
}
【问题讨论】: