Mover componetes entre paneles
Saludos a todos.
estoy tratando de mover un panel hijo entre diferentes paneles padres
y no me funciona el codigo, al parecer es algo sensillo pero me lanza un error el Ext.
si alguien ve el error o me recomienda una mejor forma de hacer ( q funcione por que mi forma no funciona ) se lo agradeceria mucho
function mover(cmpId, targetId) {
var toMove = Ext.getCmp(cmpId);
var t = Ext.getCmp(targetId);
var currentContainer = Ext.getCmp(toMove.ownerCt.id);
// sacar del padre donde esta
// si comento esta linea funciona no se por que ?
currentContainer.remove(toMove);
t.add(toMove);
currentContainer.doLayout();
t.doLayout();
}
var eastPanel={
id: 'east',
title: 'East Panel',
region: 'east',
margins: '0 0 0 0',
cmargins: '0 0 0 5',
width: 175,
minSize: 100,
maxSize: 250,
buttons: [
{
text: 'al centro',
handler: function(){
mover('conejo', 'center');
}
}
]
};
var centerPanel={
id: 'center',
title: 'Center Panel',
collapsible: false,
region: 'center',
margins: '0 0 0 0',
items: [{
id: 'conejo',
xtype: 'form',
title: 'formulario',
items: [
{
xtype: 'combo',
fieldLabel : "combito",
name: 'test',
triggerAction : "all",
mode: 'local',
valueField : "c1",
displayField : "c2",
emptyText: 'Seleccione',
store: {
xtype: 'arraystore',
fields: ['c1','c2'],
data:[['c11','c21'],['c12','c22'],['c13','c23'] ]
}
}
]
}],
buttons: [
{
text: 'al este',
handler: function(){
mover('conejo', 'east');
}
}
]
}
var container=new Ext.Viewport({
id:'main',
layout: 'border',
defaults: {
bodyStyle: 'padding:15px'
},
items: [centerPanel, eastPanel ]
});
Espero que este enlace te sirva <!-- s;) --><!-- s;) -->
<!-- m -->http://tdg-i.com/58/containers-add-and-remove<!-- m -->
¿Conoces a alguien que pueda responder esta pregunta? Comparte el link en Twitter o Facebook
Es necesario registrarse para poder participar en el foro! Si ya tienes una cuenta puedes entrar y comentar en este foro.
