我試圖將圖像添加到我當前的網格中。現在它顯示文章的名稱和我想要在每個文章名稱上添加唯一縮略圖。我的代碼正在完全替換文章名稱並返回一個破碎的圖像。將圖像縮略圖添加到ExtJS中的網格行
var grid = Ext.create('Ext.grid.Panel', {
store: gridStore,
id:'my_grid',
stateful: true,
listeners : {
'celldblclick' : function(iView, iCellEl, iColIdx, iStore, iRowEl,iRowIdx, iEvent) {
var textbody = gridStore.getAt(iRowIdx).data.id;
$('#articleBody').html(textbody);
$('#header').html('<strong> Uncategorized </strong>')
}
},
columns: [
{
text : 'Article Name',
flex : 1,
sortable : true,
dataIndex: 'company',
dataIndex:'image',
renderer : function(value, metadata, record, rowIndex,colIndex, store)
{
return "<img src='"+value+"' />";
}
},
],
height: 500,
renderTo: 'gridPanel',
viewConfig: {
stripeRows: true
}
});
另外,是否可以在DataIndex中設置多個屬性?我需要公司和圖像作爲索引。
謝謝。
如果我定義我的數據存儲像這樣: '[ [」公司','id','image'], ['company','id','image'], ['company','id','image'], ['company','id ','image'], ['company','id','image'], ['company','id','image'], ];' With image is a url to the我想加載的圖像,我將如何使用我的渲染器返回語句? – DavidMcHale92
我試過 'return record.get('company')+「」;' 但它只返回公司ID。 – DavidMcHale92
您的商店映射是否與返回的數據相匹配?看起來它沒有索引或兩個。 – existdissolve