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

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
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.

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

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
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.


Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
comments powered by Disqus
Other posts you may like...