var index=0;
var archivos=new Array(); // genero array para almacenar los id de archivos
var card = new Ext.Panel({
id:'panelw',
layout:'card',
defaults: {
border:false
},
bbar: [
{id: 'move-prev',text: 'Atras',disabled: true,handler:function(){
if(index < card.items.length){
index--;
var cardlayout = card.getLayout();
Ext.getCmp('panel-'+index).body.load('http://mistio/vfile.php?id_archivo='+archivos[index]);
Ext.getCmp('panel-'+index).doLayout();
cardlayout.setActiveItem(index);
if(index == 0){
Ext.getCmp('move-prev').disable();
Ext.getCmp('move-next').enable();
}
}
}
},
'->', // greedy spacer so that the buttons are aligned to each side
{id: 'move-next',text: 'Siguiente',handler:function(){
if(index < card.items.length-1){
index++;
var cardlayout = card.getLayout();
Ext.getCmp('panel-'+index).body.load('http://misitio/vfile.php?id_archivo='+archivos[index]);
Ext.getCmp('panel-'+index).doLayout();
cardlayout.setActiveItem(index);
if(index>0)Ext.getCmp('move-prev').enable();
if(index == card.items.length-1) Ext.getCmp('move-next').disable();
}
}
}
]
});
var Ven=new Ext.Window({
title:'Visor de imagenes',
width:700,
height:600,
layout :'fit',
modal :true,
items :[card],
listeners:{
show:function(){
Ext.Ajax.request({ // obtengo todas las imagenes
url:'tabs/ctranexos/listadoanexos',
params:{id:61401}, // id de usuario para buscar sus archivos
success:function(response,request){
var json=Ext.decode(response.responseText);
archivos=[];
json.data.forEach(function(item){
Ext.getCmp('panelw').add({ // genero paneles para cada imagen
id:item['nombre_panel'],
width :'100%',
title :'Archivo: '+item['nombre'],
border:false
});
archivos.push(item['id_archivo']);
});
Ext.getCmp('panelw').getLayout().setActiveItem(0);
Ext.getCmp('panel-'+index).body.load('http://misitio/vfile.php?id_archivo='+direcciones[0]);
}
});
}
}
});
Ven.show();
Ext.getCmp('panelw').getLayout().setActiveItem(index);
Ext.getCmp('panel-'+index).update('<iframe src="ruta imagen'" border="none" width="100%" height="100%"></iframe>');
Ext.getCmp('panel-'+index).doLayout();
Ext.get('panel-'+index).slideIn('l', { duration: 1});
It looks like you're new here. If you want to get involved, click one of these buttons!
The content of this site is copyrighted by Quizzpot.com, it is prohibited to publish our tutorials on other blogs, magazines or any other media without prior permission.
Copyright © 2012 Quizzpot.
Our visitors are mostly developers and Web designers, advertise with us, you only need to contact us .