Hide table when empty


I have an Async table that gets created even when there is no data in it.
It looks odd and i want the table to appear only when the content is there !
Is there a way to do it ?

many thanks !


Hi Kiran,

is there DataProvider attached to the table?

If so, try to get its length and check the visibility as “length>0”.


Hi Holger,

I’m getting the data from a web service in Manged Bean. I haven’t created any content provider and im not sure how and where to check the visibility.

Can you elaborate.

many thanks in advance.


Hi Kiran,

there is a property on the table which controls if it is visible or not.
If not, place the table inside a HideablePanel and set its status accordingly.

But this can be replaced by a boolean expression, in this case the number of rows of data being present in the table.

When the WS returns no data, expression should return false and when the WS returns some data the expression should return true.



Its the ‘Rendered’ property that is on every control. You can set the set the value to an expression that resolves to true or false. You should be able to construct an expression that evaluates whether the data bound to the table is empty or not.


Hi Eric,

thanks for precising the answer.


Hi Guys,

Thanks for your feed back.

I tried to put a flag in the webservice call that give false if the table is empty and true when data is present.
But still the table disappears after i click refresh.

I tried using the rendered property both on hideable pnel and table the end result is the same.
I also used the boolean data type for setting the rendered property but dint work.

Is there a specific way to do it ?

snap (3).png

Do not use both hideable panel and table rendered property at same time. Just stick to table Rendered property. Make sure your flag comes as boolean. If it is string then you can change your EL to something like below:
#{sample.webservice.result.flag == “true”}

FYI: There is a simpler solution to tell if the table data is empty without modifying your web service at all.

Just take the expression that is bound to the ‘Value’ property of the table control.

For example, if the value expression of the table control is bound to this:


If that expression resolves to an Array or List of rows, then you can simply use the “not empty” operator of the expression language to check if that list or array is empty.

For example, set the ‘Rendered’ property to an expression that is something like this:

#{not empty YourDefaultViewView.tableContent}

Or if the value expression of the table control resolves to a table content provider, then you can simply use the provided getRowCount() method of the table content provider model to get the number of rows and check if it is greater than zero.

For example, set the ‘Rendered’ property to an expression that is something like this:

#{YourDefaultViewView.tableProvider.rowCount > 0}
1 Like

Hey Eric,

That’s even simpler. Too bad i already made the changes by modifying the services in the IS.
No doubt this would be easier to implement without making any changes to the service.

thanks for your response i will surely keep that in mind and use it later.


I did that already but was doing it in a wrong way. I had to put my table inside the Hideable Panel and then use the rendered property of the table to display it when table has data and hide when it’s empty. I used the boolean flag.

And yes your way also works if i’m not using boolen flag.

Thanks for your suggestion.