0
我創建一個面板,顯示圖像的左側縮略圖,以及當我點擊右側面板上顯示的圖像時。 它的作品,但我想當我打開此頁面,並沒有點擊任何拇指,它顯示我在右側面板上的一個默認圖像(此值包含默認圖像D.data.defaultimage的鏈接)DataView與Extjs 3
這是我對這個面板代碼:
var Pstore = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'page.php?cmd=Affich',
method: 'POST'
}),
root: 'images',
fields: [ 'name', 'url', 'thumb_url' ]
});
Pstore.load();
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="thumb-wrap" id="{name}">',
'<center><img src="{thumb_url}" title="{name}"></center>',
'<span>{name}</span></div>',
'</tpl>'
);
tplDetail = new Ext.XTemplate(
'<div class="details">',
'<tpl for=".">',
'<center><img src="{url}"></center>',
'</tpl>',
'</div>'
);
datav = new Ext.DataView({
autoScroll : true,
store : Pstore,
tpl : tpl,
autoHeight : false,
multiSelect : true,
overClass : 'x-view-over',
itemSelector: 'div.thumb-wrap',
emptyText : 'No images',
listeners: {
click: {
fn: function() {
selNode = datav.getSelectedRecords();
tplDetail.overwrite(panelPreview.body, selNode[0].data);
panelPreview.body.fadeIn('l', {duration:0.5});
}
}
}
})
var panelLeft = new Ext.Panel({
id : 'images-view',
title : 'Pages',
autoScroll : true,
region : 'west',
frame : true,
width : 180,
layout : 'fit',
items : datav
});
panelPreview = new Ext.Panel({
title : 'Aperçu:',
region : 'center',
autoScroll : true,
frame : true,
layout : 'fit',
id : 'panelDetail',
tpl : tplDetail
});
Affich = new Ext.FormPanel({
frame : true,
layout : 'border',
bodyStyle : 'padding:5px',
renderTo : 'right-bottom',
items : [panelLeft, panelPreview]
});
謝謝你幫我
我嘗試這樣做:panelPreview =新Ext.DataView({ \t \t \t商店\t:的PStore, \t \t \t標題\t: 'APERCU:', \t \t \t區域\t: '中心', \t \t autoScroll \t:true, \t \t frame \t \t:true, \t \t佈局\t \t: '適應', \t \t \t ID \t \t: 'panelDetail', \t \t \t上層階級: '× - 視圖 - 過', \t \t itemSelector: 'div.thumb纏繞', \t \t \t emptyText:tplDetail2, \t \t \t TPL \t \t:tplDetail \t \t }); \t和tplDetail2 = new Ext.XTemplate( \t \t'
我認爲在這種情況下emptyText需要是一個字符串,而不是一個對象。當它是一個面板時,您是否可以嘗試將數據配置傳遞給panelPreview? – awshepard