OnAfterRender Events issue

edited December 2018 in Technical questions

Hi Webix Team,

In this snippet, If I am recompiling the angular controller and if I am clicking on tree unnecessary onAfterRender event is firing.Because of that my tree is refreshing.
How to solve this issue?



  • Hello,

    onAfterRender will be called for each component repaint, if multiple items updated it can be called multiple times
    This is expected behavior

    If you need to call some code after UI was constructed, you can use webix-ready attribute for the directive in question
    Check https://webix.com/old-snippet-tool/3a6a08b0

  • @Nastja ,

    I tried your solution but it causes same error.


    If I am clicking on second tree item my onAfterrender event is firing, which refreshes the tree. Please provide me the solution for this.
    I got stuck.


  • onAfterRender occurs each time when widget repainted.
    You can’t change this behavior.
    If you need to catch the moment when a component was painted the first time, you can use webix-ready directive

    <div webix-ui=“first_config” webix-ready=“doAfterInit(root)”

    Also, beware that any change to the scope will trigger the view repainting, which means new onAfterRender call
    Making UI as a single entity, instead of using multiple directives will simplify things a lot.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!