2012-09-28 34 views

回答

2

是的,你可以。但取決於您的要求選擇哪種方式。

  1. 使用CSS。當你定義一個欄,設置 'tdCls' 屬性:

    { 
        header: 'Image and text column', 
        tdCls: 'img-col', 
        dataIndex: 'Text' 
    } 
    

    在CSS文件:

    td.img-col { 
        background-image: url(images/pic.png); /*16px*/ 
        background-repeat: no-repeat; 
    } 
    
    td.img-col .x-grid-cell-inner { 
        margin-left: 16px; 
    } 
    
  2. 使用模板列:

    { 
        xtype: 'templatecolumn', 
        header: 'Image and text column', 
        tpl: [ 
         '<img src="{ImgPath}"></img>', 
         '<div>{Text}</div>' 
        ] 
    } 
    

    而且你的模型應該有ImgPath物業

+0

非常感謝 求助。 –

相關問題