Thursday, October 9, 2008

Multiple ways of specifying width for af:table and precedence rules

This post is about a minor functional idiosyncrasy I discovered while working on another problem. In fact, it is a corollary of configuration posted for an earlier blog entry.

The issue is that af:table has a dedicated attribute called width for specifying the width of the table. But like all other ADF Faces components, it also has an inlineStyle attribute which can be used for specifying the width (along with many other style settings). There is a slight difference in the syntax for specification for each of these, e.g. width="100%" as opposed to inlineStyle="width:100%;". Well, these can potentially be conflicting settings. If both of them are specified, which one is the real setting and what are the precedence rules? By doing a quick test, the functional specification for precedence is:

  • If width is specified through both "width" and "inlineStyle" settings, the "width" setting takes precedence and any width specified through inlineStyle is ignored.
  • Value in inlineStyle="width:whatever;" is only looked at, if no value specified in "width'".
Simple enough. But I'm afraid I haven't seen it functionally specified explicitly like this anywhere else, hence worth calling it out here with a dedicated post.

No comments: