Search code examples
extjsextjs6extjs6-modern

Extjs 6.x Modern : Why template methods like onRender are not working?


As mentioned in this Docx Component Life Cycle the template methods like initComponent (initialize -> working), onRender are not invoked when override in the subClass.

Ext.define('My.custom.Component', {
extend: 'Ext.Component',
onRender: function() {
    this.callParent(arguments); // call the superclass onRender method

    // perform additional rendering tasks here.
    }
});

Is there any change in the Component Life cycle for Modern toolkit? If so what is it?

Here is the fiddle


Solution

  • The guide you found has just been copied from older versions of ExtJS, where modern toolkit was not included; for example, the very same guide was already available in 4.2.2. The concepts do not hold exactly for modern toolkit, although there are similarities.

    It seems there is no single event or function that is called for both toolkits. I would recommend to not touch the onRender event unless absolutely necessary, because it has no counterpart in modern. Use either the "constructors" (initComponent/initialize) or listeners (afterrender/painted).

    You would have to ask in the Sencha forum whether these differences will be resolved in ExtJS 6.5.