update.renderContext.displayRequired

sgodden's picture

I notice that wherever update.renderContext.displayRequired is used, there is a warning that it is an experimental API.

Just to let you know that I am using this for ExtJS integration, since I need to ensure that all actual component creation is deferred to the renderDisplay phase to ensure that the parent elements are in the DOM at component creation time, since Ext requires this.

So just a request to ensure this capability is not removed. Of course, its implementation might change, and I'm happy to refactor accordingly.

displayRequired is only there

displayRequired is only there for performance reasons, and that part of the API is experimental. renderDisplay itself is part of the API.

sgodden's picture

I understand. Perhaps I am

I understand. Perhaps I am making a feature request.

I need there to be a way, in the public API, for a sync peer to force the render engine to call renderDisplay during the render display phase. The reason for this is that currently, renderDisplay is only called on immediate descendants of panes.

So if I add, say, an ext combo box to an echo grid, then according to the current implementation, renderDisplay will not be called on that combo box. This is a showstopper for me, since I must guarantee that the parent element is in the dom before creating the ext component, which can only be guaranteed in renderDisplay.

I get around this by using displayRequired.

Do you see this as a feature request? Shall I raise it on Mantis?

I don't understand

Perhaps you can give me a code sample for this. In Echo, every component peer gets its renderDisplay called (if it's there), the magic behind this happens in Echo.Render._doRenderDisplay (Render.js). This method calls renderDisplay on the added/updated component peer and recursively on its children. The individual peers are responsible for dealing with sizing the elements they create only.

Hope this helps,

Niels

sgodden's picture

Indeed, I misread the code

Indeed, I misread the code in processUpdates, and I can see now that the displayRequired is an optimisation, whereas I had read it as the only way to get renderDisplay called. If displayRequired is not defined, then _doRenderDisplay is called for the parent of the update, and then recursively for all of its children.

So I need to go back to debugging to find out why my renderDisplay method is not being called on an update.

sgodden's picture

I found my problem. In

I found my problem.

In order to allow echo3 components to be added to ext containers, I created a small adapter class to perform the necessary initialisation for the ext parent container.

But it was waiting until render time to invoke Echo.Render.renderComponentAdd on the child, meaning that the child's peer was not available during the renderDisplay phase.

So if I added an echo grid to an ext container, and then added an ext combo box to the grid, renderDisplay would not be invoked on anything from the grid downwards, since its peer did not exist.

Unfortunately, not reading the processUpdates code correctly sent me chasing red herrings.

Simple fix - solved.