I create a panel that show me on the left thumbnails of images and when I click on an image it shows on the right panel. It works but i want when i open this page and without clicking on any thumb, it shows me on the right panel a defaut image (this value contain the link of the default image D.data.defaultimage)
这是我的本小组守则:
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]
});
感谢我的帮助