aspose file tools*
The moose likes JSF and the fly likes How to use datatable with no records in a list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to use datatable with no records in a list" Watch "How to use datatable with no records in a list" New topic
Author

How to use datatable with no records in a list

Priti Shah
Ranch Hand

Joined: May 10, 2005
Posts: 43
Hi ,

I have a datatable which displays 4 columns. Each column has a header. I use arraylist with datatable.

Here is what i want to do. When arraylist has values then datable works fine but when arraylist is null or has size 0 I still want to display column headers and a single row dispalying message "No record found".

I did following for this.

First I added this


So this will not renderer my datatable at all if list is null.

Now I add another datatable tag with


This data table will only show headers and a 'no rec found' message. But this will show message in the first column only. I want to display it as one row without any columns.(In HTML terms I want to assign colSpan=4 to display it as a row)

If any one can suggest any thing.

Thanks in advance.
[ September 07, 2005: Message edited by: Gregg Bolinger ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I edited your post to use Code Tags and I also removed the smilies. In the future try to use code tags when posting code and especially when posting JSP tags and such disable smilies in the post. There is a checkbox towards the bottom of the new post form.


GenRocket - Experts at Building Test Data
Priti Shah
Ranch Hand

Joined: May 10, 2005
Posts: 43
Ok thanks i will keep that in mind.
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Customize the data table renderer.


- Varun
seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
Originally posted by Priti Shah:

Here is what i want to do. When arraylist has values then datable works fine but when arraylist is null or has size 0 I still want to display column headers and a single row dispalying message "No record found"...


Couldn't you use PanelGrid with PanelGroup in the #{empty myBean.list} case? See PanelGrid example: http://www.exadel.com/tutorial/jsf/jsftags-guide.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use datatable with no records in a list