• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to use datatable with no records in a list  RSS feed

 
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 ]
 
Ranch Hand
Posts: 15304
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.
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customize the data table renderer.
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!