André Shevantes
André Shevantes

Reputation: 449

What triggers a Control re-rendering after the initial page load?

I was working with Controls in SAPUI5 and saw events like onBeforeRendering and onAfterRendering on them; I supposed a Control was rendered only one time (in the initial loading of the page); However, are there other occasions that re-render a control without full a page reload? And in what occasions makes sense to re-render a control? How it is useful to the developer? Thanks in advance!

Upvotes: 2

Views: 4936

Answers (1)

mlenkeit
mlenkeit

Reputation: 311

A control is usually re-rendered when

  • a property changes
  • an aggregation is manipulated
  • an aggregated control requests so

To be precise, any of the above only invalidates the control which tells the UI5 runtime core that re-rendering is necessary (which then happens asynchronously for performance reasons).

Depending on the implementation, re-rendering can be suppressed. E.g. the sap.m.Text control doesn't invalidate the control when the text property changes but just manipulates its DOM directly.

For the the majority of scenarios, you don't need to worry about re-rendering. It's being taken care of by the UI5 runtime. In fact, for most scenarios, when you need to explicitly re-render/invalidate a control, there's probably something wrong with your implementation.

Upvotes: 5

Related Questions