• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to use datatable with no records in a list

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok thanks i will keep that in mind.
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Customize the data table renderer.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I was born with webbed fish toes. This tiny ad is my only friend:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic