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