-
6 Jan 2013 11:54 AM #1
Unanswered: Use of Render/ Ext.getBody()
Unanswered: Use of Render/ Ext.getBody()
Hi All,
Hope you are all doing good.
I am new in ext-js 4. I have some queries during examples.
app.js
and Student.jsCode:Ext.application({ name : 'MyApp', requires : ['Ext.window.MessageBox', 'MyApp.view.Student'], launch : function() { var student = Ext.create('MyApp.view.Student', { id : 'The Portal' }); student.render(Ext.getBody()) //console.log(student.getId()); } });
In my above example, I want to display id of student on the page..How can i do that ?Code:Ext.define('MyApp.view.Student', { extend : 'Ext.Component', config : { id : '' }, constructor : function(config) { this.initConfig(config); } });
and don't know proper use of renderTo/ Ext.getBody() method,
and during run this program i get following error :
"Uncaught TypeError: Cannot read property 'beforerender' of undefined";
Please guide me..
Thanks
-
7 Jan 2013 7:10 PM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,183
- Vote Rating
- 194
- Answers
- 433
You should not be setting the id to '', or with spaces. It is recommended that you do not set id at all and let the id gen automatically.
I would suggest using itemId and then use componentQuery to get access:
http://docs.sencha.com/ext-js/4-1/#!...ComponentQuery
panel.down('#panel-itemid')
As for the render .. if you are rendering to the body, then:
renderTo: Ext.getBody(), or renderTo: document.body
Typically would would render a viewport (auto render to body) or render a panel to the body and they draw the component in the panel.
Scott.


Reply With Quote