Every component returns false from getOuputMarkupId() by default.
I am curious about the reason. The design decision behind.
I am using ajax components and I need to refresh some others components on a page. To do that I got to setOutputMarkupId(true) on every component which is involved in ajax page refreshing. Because I heavily use ajax I got to do it very often. And it's not very convenient. Besides "The Best Code is No Code At All".
I can handle it this way:
class MyApp extends Application {
@Override
public init() {
Application.addComponentInstantiationListener(
new IComponentInstantiationListener() {
public void onInstantiation(Component component) {
component.setOutputMarkupId(true);
component.setOutputMarkupPlaceholderTag(true);
}
}
);
But is there any trade-off? Only trade-offs comes to my mind are:
- rendered page (html) is larger
- there is some rendering overhead (ie. when id attributes are write down to html)
But those have only small footprint imho.