wilfredor
18 Aug 2009, 10:36 AM
My Tab definition
Ext.onReady(function(){
// basic tabs 1, built from existing content
// second tabs built from JS
var tabs2 = new Ext.TabPanel({
renderTo: 'container',
activeTab: 0,
width:'70%',
height:200,
plain:true,
defaults:{autoScroll: true},
enableTabScroll : true,
animScroll: true,
layoutOnTabChange: true,
items:[{
title: 'Tab 1',
html: "Content o my tab"
},{
title: 'Formulario',
nocache: true,
text: "Loading...",
timeout: 10,
autoLoad: {url: 'myform.js',scripts: true}
}
]
});
// If I add "tabs2.get(1).add(formulario);" here, Firebug show :::-formulario is not defined-:::
}); myform.js
<script language="javascript">
/*** parametros para pintar el formulario*************/
var formulario = new Ext.FormPanel({
labelAlign: 'top',
title: 'Datos del Empleado',
bodyStyle:'padding:10px;',
id:'formulario',
layout: 'form',
width: '70%',
items: [{
layout:'column',
border:false,
items:[{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'Nombre',
id: 'nombre',
name: 'nombre',
anchor:'95%',
allowBlank:false
}, {
xtype:'textfield',
fieldLabel: 'Dirección',
id: 'direccion',
name: 'direccion',
anchor:'95%',
allowBlank:false
}
]
},{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'Ciudad',
id: 'ciudad',
anchor:'95%',
allowBlank:false
},{
xtype:'textfield',
fieldLabel: 'Estado',
id: 'estado',
anchor:'95%',
allowBlank:false
}
]
}]
}],
buttons: [{
text: 'Guardar',
},{
text: 'Cancelar',
}]
});
/********* Render de objetos **********/
tabs2.get(1).add(formulario); // Here's the problem Firebug Show :::-tabs2 is not defined-:::
});
</script>
Ext.onReady(function(){
// basic tabs 1, built from existing content
// second tabs built from JS
var tabs2 = new Ext.TabPanel({
renderTo: 'container',
activeTab: 0,
width:'70%',
height:200,
plain:true,
defaults:{autoScroll: true},
enableTabScroll : true,
animScroll: true,
layoutOnTabChange: true,
items:[{
title: 'Tab 1',
html: "Content o my tab"
},{
title: 'Formulario',
nocache: true,
text: "Loading...",
timeout: 10,
autoLoad: {url: 'myform.js',scripts: true}
}
]
});
// If I add "tabs2.get(1).add(formulario);" here, Firebug show :::-formulario is not defined-:::
}); myform.js
<script language="javascript">
/*** parametros para pintar el formulario*************/
var formulario = new Ext.FormPanel({
labelAlign: 'top',
title: 'Datos del Empleado',
bodyStyle:'padding:10px;',
id:'formulario',
layout: 'form',
width: '70%',
items: [{
layout:'column',
border:false,
items:[{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'Nombre',
id: 'nombre',
name: 'nombre',
anchor:'95%',
allowBlank:false
}, {
xtype:'textfield',
fieldLabel: 'Dirección',
id: 'direccion',
name: 'direccion',
anchor:'95%',
allowBlank:false
}
]
},{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'Ciudad',
id: 'ciudad',
anchor:'95%',
allowBlank:false
},{
xtype:'textfield',
fieldLabel: 'Estado',
id: 'estado',
anchor:'95%',
allowBlank:false
}
]
}]
}],
buttons: [{
text: 'Guardar',
},{
text: 'Cancelar',
}]
});
/********* Render de objetos **********/
tabs2.get(1).add(formulario); // Here's the problem Firebug Show :::-tabs2 is not defined-:::
});
</script>