Just wondering what the Webix equivalent of the React ‘componentDidMount’ handler. I’m trying to bind the view to a model, but currently that requires polling the DOM, for every component, to wait until it’s there in order to do the binding.
So, do you have a handler that I can register on which fires after the component is in the DOM?
Alternatively, is there an alternative like a proxy that can be used for this?
webix.ui({
view:"list",
ready:function(){
//component is initialized
}
})
In common case, the component is available just after webix.ui call, so you need not any special handler, as you can attach your logic by placing it next to webix.ui call.
Also, there is a way to define event handlers as part of json configuration, so again there is no need to attach them by separate code lines.
Hi Maksim, I’m back, just renewed license!
From my recollection this didn’t work (that was version 1.9).
The problem for example was with anything that wasn’t already in the DOM.
For example a datatable row that I wanted to be able to react dynamically to new data.
I ended up needing a ‘waitFor’ function that had to poll $$(id) and attach a callback when it was found.
Is the ‘ready’ handler available for all elements, or just the top level?
You can get the moment when the componen as js object is ready for operaions, but there is no any public event when some part of HTML is rendered
You can try to use the onAfterRender event
Event occurs after the component’s renderingand while it doesn’t provide all necessary info, you can call something like getVisibleCount and getScrollTop to detect which rows are visible.