2013-04-03 24 views

回答

5

你可以嘗試添加一列渲染器到您的網格。

{ 
    text: 'Comments', 
    dataIndex: 'comment', 
    renderer: function(value, metaData, record, row, col, store, gridView) { 
    if (record.get('comment') == "") { 
     return "-"; 
    } else { 
     return record.get('comment'); 
    } 
    } 
} 

查看Column renderer in the ExtJS API瞭解更多詳情。

+2

爲什麼不使用值而不是record.get('comment')? – 2013-04-03 06:34:26

+0

同意,這是更好的解決方案。我只是使用OP的示例代碼。 –