PDA

View Full Version : Trying to extend Ext.Panel or Ext.Container but either way I get an error.



ItsGarand
27 Jul 2016, 6:25 AM
Ok, so I am basically trying to stand up a wrapper for Leaflet. I'll be adding this to a viewer panel that already works using MyViewer.add(MyExtendedPanel). It looks like it basically works, but if I extend a Panel, I get the following error:
TypeError this.toolbars is undefined
* if(this.toolbars.length > 0)

If I entend Ext.Container I get:
TypeError me.events is undefined
*ce = me.events[ename]

So, in either case, what am I missing?



Ext.ux.MyExtendedPanel = Ext.Extend(Ext.Panel,{

id: my_wrapper,

constructor: function ()
{
Ext.ux.MyExtendedPanel.superclass.constructor.call(this, arguments);
},
initComponent: function ()
{
Ext.ux.MyExtendedPanel.superclass.initComponent.call(this, arguments);
}
});


Adding an empty normal Panel seems to work, adding and extended Panel or container throws an error. Any clues as to what I'm missing? What basic things must I do when extending a class?

Gary Schlosberg
27 Jul 2016, 7:20 AM
So it works with a regular panel but not the Leaflet one? Are you talking about this?
http://leafletjs.com/

ItsGarand
27 Jul 2016, 8:36 AM
Correct. I am trying to stand up the Leaflet wrapper.

I have had some success, The map even appears, I just can't seem to resolve the error when extending a Panel or extending a Container

ItsGarand
27 Jul 2016, 9:08 AM
So, I am attempting to nest one panel in another.

So, if I declare a new panel like this
var NewPanel = new Ext.Panel();

then add it to my viewer panel like this
viewer.add(NewPanel);

I get a properly sized (but empty) panel nested inside my viewer panel. With no errors thrown
so far so good....

If I extend a panel:

Ext.ux.MyExtendedPanel = Ext.Extend(Ext.Panel,{...}

Then add it to my panel
var NewPanel = new Ext.ux.MyExtendedPanel();
viewer.add(NewPanel);

Like above I'll get the nested panel but I also get the following error:

TypeError this.toolbars is undefined
* if(this.toolbars.length > 0)

I can't seem to figure out what is causing the error.

Gary Schlosberg
26 Aug 2016, 4:05 PM
Does it work if you use ext-all-debug.js?