PDA

View Full Version : Extended Class of a formpanel doesn't show a frame



JoepRonde
19 Sep 2012, 5:26 AM
I want to extend a formpanel with default frame = true. The code below defines a custom class for a floating, draggable formpanel with a frame. Creating an instance of this class doesn't show a frame. It seems that the initConfig doesn't set the frame to true. Why not?
Only when I create a instance of this class with a config object with frame = true it shows a frame.
Can anyone explain this?


Ext.define('MyForm', {
extend: 'Ext.form.Panel',


config: {
title: 'This panel wants a frame',
width: 200,
height: 100,
frame: true, // setting frame to true should give a frame, but it doesn't
floating: true ,
draggable: true
},
constructor: function(config) {
// Calling the constructor of the parent class.
this.callParent(arguments);


// Initializing the config settings.
this.initConfig(config);
}
});


Ext.create('MyForm').showAt(10,10);
Ext.create('MyForm', {title: 'Now it has a frame', frame: true}).showAt(250,10);

mitchellsimoens
24 Sep 2012, 7:01 AM
In Ext JS, you should really not use the config object. Some things may work but all in all, it's not fully implemented in the framework classes.

JoepRonde
24 Oct 2012, 5:05 AM
I think you're right, but then Sencha should update the documentation on this. I got this example from the Ex.Class documentation.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Class-cfg-config
(http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Class-cfg-config)