2
我有一個商店,其字段中包含「Y」或「N」字段。我想採用Y或N值,並在網格中放置一些綠色或紅色圖標,而不是文本。我一直在使用條件渲染函數,但我無法弄清楚如何根據值顯示圖標。到目前爲止,我有Extjs 4網格:根據商店文本值在單元格中放置圖標
initComponent: function() {
this.columns=[
{header: 'PreReq', dataIndex: 'PreReq', width: 50,
renderer: function(value){
if(value == 'Y'){
//some code to put green icon in this cell
}
else if(value =='N'){
//come code to put red icon in this cell
}
else{
//some code to put error icon in this cell
}
}
}
];
this.callParent(arguments);
}
或者你可以使用'metaData.tdClass 「如果你願意這樣做的話。 – Izhaki
@Izhaki:值得再增加一個答案。我喜歡它 – zerkms
認爲一個完整的答案比兩個更好 - 所以我把它與你的合併。 – Izhaki