PDA

View Full Version : How to get parent class when extending



wallynm
6 Dec 2011, 6:16 AM
Hello guys, i'm with some trouble when i try to get the parent class name...

This is my code:


Ext.define('gconnect.view.Financeiro.Categorias.CargosFuncoes.Form', {
extend: 'Ext.helper.Abstract.DefaultEditWindow',
alias: 'widget.CargosFuncoesForm',
id:'CargosFuncoesForm',
title: 'Editar Cargos/Funções',
windowItems: [{
xtype: 'form',
border:false,
defaultType: 'textfield',
bodyPadding: 5,
items: [{
fieldLabel: 'Cargo/Função',
name : 'cargo',
anchor: '100%',
labelWidth: 110,
allowBlank: false
}]
}]
});


It extend to this class:


Ext.define('Ext.helper.Abstract.DefaultEditWindow', {
extend: 'Ext.window.Window',
layout: 'anchor',
autoShow: true,
modal: true,
width: 400,
windowItems: undefined,
initComponent: function() {
this.items = this.windowItems;

this.buttons = [{
text: 'Salvar',
action: 'atualizarRegistro'
},{
text: 'Salvar',
action: 'inserirRegistro'
}, {
text: 'Cancelar',
action: 'cancelar',
scope: this,
handler: this.close
}];


this.callParent(arguments);
}
});


Well, what i'm needing is get the class name inside Ext.helper.Abstract.DefaultEditWindow, so, if gconnect.view.Financeiro.Categorias.CargosFuncoes.Form are extending to defaultEditWindow, i would like to get this name to define some default values.

mitchellsimoens
6 Dec 2011, 9:01 AM
I would set a property to tell you this.

You could get the current classname in initComponent:


this.__proto__['$className']

wallynm
6 Dec 2011, 9:08 AM
I would set a property to tell you this.

You could get the current classname in initComponent:


this.__proto__['$className']

Nice, i will try it, actually im using the alias property, as i couldn't see anything about how to get the parent class on the doc's. Thanks 4 reply!