• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use datatable with no records in a list

 
Priti Shah
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Priti Shah
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok thanks i will keep that in mind.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customize the data table renderer.
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic