我试图将图像添加到我当前的网格中。现在它显示文章的名称和我想要在每个文章名称上添加唯一缩略图。我的代码正在完全替换文章名称并返回一个破碎的图像。将图像缩略图添加到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