I have the following Ext.getElementById call from a specific part of application code, that does work when called in this context:
init: function() {
// template method called when app boots; before Viewport is created
this.control({
'launcherlist': {
itemclick: function (dataView, record) {
Ext.getElementById('element-id');
},
}
...
}
However I need to call the getElementById at an earlier stage, before having any user- triggered event occurring.
When getElementById is called directly within init it doesn’t work as init is called when app boots; before Viewport is created.
So I decided to override the controller’s onLaunch event, since onLaunch is a template method like init, but is called after Viewport is created:
onLaunch: function() {
Ext.getElementById('element-id');
},
However this didn’t work either.
TL/DR
Where can I put a working Ext.getElementById call before any user-triggered-action takes place?
Solution:
Since the widget that renders the DOM element I’m looking for extends
Ext.view.View, the correct event after whichExt.getcan actually find the rendered element is theviewreadyevent.P.S. One should use
Ext.getanywhere rather thanExt.getElementByIdas the latter is a private method.