PDA

View Full Version : Rendering custom xtype widget to a container



mirkotus
15 Jan 2014, 1:33 AM
I create a custom xtype widget from a promooted class. When I want to render the widget to a container I get an error Cannot read property 'dom' of null.

cont is my container


var d = Ext.widget('MultiViewComponent', {
renderTo: cont
});

I have tried
renderTo:cont.getLayout().
I have also tried using
cont.add and then
cont.doLayout();

For renderTo documentation states:
Do not use this option if the Component is to be a child item of a Container (http://docs.sencha.com/extjs/4.2.2/#%21/api/Ext.container.Container). It is the responsibility of the Container (http://docs.sencha.com/extjs/4.2.2/#%21/api/Ext.container.Container)'s layout manager (http://docs.sencha.com/extjs/4.2.2/#%21/api/Ext.container.Container-cfg-layout) to render and manage its child items.

When using
add the component was visible on the screen but not seen inside
cont.items so I could not remove it.

What am I missing here or doing wrong? Please help and advise.

evant
15 Jan 2014, 1:40 AM
Post a fiddle: http://fiddle.sencha.com

mirkotus
15 Jan 2014, 1:43 AM
I'm not very familliar with the fiddle besides it would be a lot of work to create a custom xtype inside fiddle. Can you just please take another look at my question.

evant
15 Jan 2014, 4:03 AM
That's why I asked you to make a fiddle. It's not apparent from those out of context code snippets what the problem is.

Edit:

I see you also posted it at SO: http://stackoverflow.com/questions/21133737/rendering-custom-xtype-widget-to-a-container

Closing this thread so people don't spend any more time on it. This underlines why it's important for you to post relevant code.

mirkotus
15 Jan 2014, 5:03 AM
I have found the sollution here. http://stackoverflow.com/questions/21133737/rendering-custom-xtype-widget-to-a-container

Thanks anyway.