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

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.


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.