onAfterRender for everything

https://snippet.webix.com/m5ra7smd

If you open the console, you can see “template onAfterRender” but not “container onAfterRender”.

Always sticked with this problem since YEARS. See common rendered event for all components ? - #5 by franck34

Why this limitation ? it make me crazy . :triumph: . A container is a webix component. I don’t understand why onAfterRender is not available for containers. The container is added to the DOM, like every components.

In webix-jet, we have init() & ready() function, and it’s working for anything, probably because it’s using addView.

Is there a way (mixin, patch, hack, request feature, paid request feature) to solve this point ?

This is a problem when making generic class, something like this

class foo() {
  constructor(config) {
    config.on = config.on || {};
    config.on.onAfterRender(this.onAfterRender.bind(this));
  }
  
  onAfterRender() {
  }
});

Please …

Good day @franck34 ,

As a possible workaround, you could create a custom layout (with protoUI) and change its $init() a bit. There you could find all layout’s children elements that have render method and call their onAfterRender event. Then, when all children has been rendered, you could call the onAfterRender for the parent component.

Have a look at the example: Code Snippet .

Also, please, note, that it will work only for the initial layout rendering. On layout’s init we can catch the moment when all children has been rendered and call the event for the parent. However, after that when the onAfterRender event is called by one of the inner views in the layout, it’s unclear how and in what cases to call the event in a parent.

1 Like

very interesting, thank you !