PDA

View Full Version : Promblem in Window.close() with statusbar



franktrevi
18 Sep 2012, 6:30 AM
This is definition my view:


Ext.define('App.view.cliente.CapturaEdicionClientes', {
extend: 'Ext.window.Window',
height: 480,
width: 590,
autoShow: true,
layout: {
type: 'border'
},
closable: false,
title: 'ActualizaciĆ³n de Clientes',
modal: true ,
bbar: Ext.create('Ext.ux.statusbar.StatusBar', { //<----- Create StatusBar

defaultText: 'Listo',
id: 'sbFrmCliente' ,
plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {
form:'frmCliente'
})
}) ,
...



When click button Cancel into Form from view, the statusbar not appear the next time

{
xtype: 'button',
width: 80,
text: 'Cancelar',
iconCls:'cancelar',
scope: this,
handler: this.close //<----- Close
}

the next time Win.Show() , error JavaScript :



TypeError: me.dom is undefined
me.dom.style.width = me.addUnits(width);

3876138762
StatusBar not Load!!!

Help me please!!
Sorry for my bad english!!!


Using this.hide to close window...

38763

scottmartin
18 Sep 2012, 6:50 AM
This would be hard to tell with the limit code provide. My initial comment would be to remove all uses of 'id' from your components to prevent collision .. use itemId instead.

Scott.

franktrevi
18 Sep 2012, 4:07 PM
Thank scott, but all component id are different!!!

scottmartin
18 Sep 2012, 7:34 PM
Humor me ..

I was not talking about with other components, but with the same instance.

Scott.

franktrevi
19 Sep 2012, 7:49 AM
This is controller..



Ext.define('App.controller.Clientes.Clientes',{
extend : 'Ext.app.Controller',
stores : ['Clientes.Clientes'],
models : ['Clientes.Clientes'],
views : ['Clientes.GrdClientes','Clientes.CapturaEdicionClientes'],
refs:[

{
ref:'RefgridClientes',
selector:'gridClientes'
}

],

init : function() {
var me = this;
me.control({
'gridClientes dataview': {
itemdblclick: this.Editar,
},
'gridClientes button[action=actAgregar]':
{
click:this.Agregar
},
'gridClientes button[action=actEditar]':
{
click:this.Editar
},
'FormAddEdicionClientes button[action=actGuardar]':
{

click:this.ActualizarCliente
},
'gridClientes button[action=actBorrar]':
{
click:this.Eliminar
},
'gridClientes button[action=actImprimir]':
{
click:this.Imprimir
}




});
},
//Inician Funciones

Agregar: function(){
var FormAddEditarClientes= Ext.widget('FormAddEdicionClientes');
//-->show window in mode Add Record
// the first time , statusbar OK.. , the next time Statusbar NOT LOAD.. error Javascript
},

Editar: function(grid, record){
records = this.getRefgridClientes().getSelectionModel().getSelection();
if(records.length > 0){
var FormAddEditarClientes= Ext.widget('FormAddEdicionClientes');
var EditForm=FormAddEditarClientes.down('form');
var record=records[0];
EditForm.loadRecord(record);
//-->show window in mode Edit Record
// the first time , statusbar OK.. , the next time Statusbar NOT LOAD.. error Javascript
}

},

ActualizarCliente: function(button) {
var win = button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();

if (values.idcliente > 0){
record.set(values);
} else{
record = Ext.create('App.model.Clientes.Clientes');
record.set(values);
MyStoreClientes.add(record);

}
win.close();


},

Eliminar: function()
{

var grid = this.getRefgridClientes();
record =grid.getSelectionModel().getSelection();
Cliente=grid.getSelectionModel().getSelection()[0].data.Cliente;
//En esta parte automaticamente el Controller crea las Funciones Getters
store = MyStoreClientes;
Ext.MessageBox.show({
title : 'Eliminar Registro',
buttons : Ext.MessageBox.YESNO,
msg : 'Desea Eliminar'+' '+Cliente+'?',
icon : Ext.Msg.WARNING,
fn : function(btn)
{
if (btn == 'yes')
{
store.remove(record);


}

}
});
}
});


view cliente.CapturaEdicionClientes ..


Ext.define('App.view.cliente.CapturaEdicionClientes', {
extend: 'Ext.window.Window',
alias:'widget.FormAddEdicionClientes', //alias for use into controller, using Ext.Component.Query
....

vietits
19 Sep 2012, 5:52 PM
Your problem is at sharing objects on prototype. Below is a solution to fix this problem:


Ext.define('App.view.cliente.CapturaEdicionClientes', {
extend: 'Ext.window.Window',
height: 480,
width: 590,
autoShow: true,
layout: {
type: 'border'
},
closable: false,
title: 'ActualizaciĆ³n de Clientes',
modal: true ,
// bbar: Ext.create('Ext.ux.statusbar.StatusBar', { //<----- Create StatusBar
// defaultText: 'Listo',
// id: 'sbFrmCliente' ,
// plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {
// form:'frmCliente'
// })
// }),
initComponent: function(){
var me = this;
me.bbar = Ext.create('Ext.ux.statusbar.StatusBar', { //<----- Create StatusBar
defaultText: 'Listo',
id: 'sbFrmCliente' ,
plugins: Ext.create('Ext.ux.statusbar.ValidationStatus', {
form:'frmCliente'
})
});
me.callParent(arguments);
},
...

franktrevi
20 Sep 2012, 8:28 AM
thanks, vietits..
I have changed as you suggest it and now I get this error javascript...


TypeError: sb.statusEl is undefined
sb.statusEl.getEl().on('click', this.onStatusClick, this, {buffer:200});
http://localhost/mercurio/assets/js/ext_plugins/statusbar/ValidationStatus.js
Line 97