Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

| Views: 2096
I've been doing a fair amount of ADF work recently and especially dealing with tables. What I found was that when a table contained no data, the emptyText string rendering is very ugly by default, so I got exploring. It turns out you can put HTML into this string and customise how it is rendered with some CSS.

Here is what I mean by ugly, there really should be some padding on the left of the text.
aftable1.png


My end result was to add a small amount of padding to align the emptyText to the table header. It looked like this:
aftable2.png


Much more pleasant to look at!

To get this to work, I had to put HTML into the emptyText attribute of af:table. Here's a code snippet:
 af:table snippet
<af:table
...
emptyText="&lt;html>&lt;span style=&quot;padding-left:2px;&quot;>No Data&lt;span>&lt;/html>"
..
>


The CSS adds a 2-pixel padding on the left of the text, it's as simple as that.

Note that the start of the tags have to be escaped, this had me stuck for a while. Also note that the entire string has to be encompassed inside a <html> element.



-i

Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
comments powered by Disqus
Other posts you may like...