File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes First row to be empty inside a datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "First row to be empty inside a datatable" Watch "First row to be empty inside a datatable" New topic

First row to be empty inside a datatable

Shasi Mitra
Ranch Hand

Joined: Nov 27, 2008
Posts: 101

Hi all- i have to display the data from the second row in the datatable and in the first row i should have a check box with select all label. How is it possible? Can i have something like first= -1 in datatable? If i add one dummy VO with spaces as the first object in the list it worke fine but i'm looking for better options..Any clue?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
What's wrong with an empty VO?

You don't need spaces though. Nulls (object's default value) are perfectly suitable.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

A variation on that theme is to put the "select all" control in the table header. This may be preferable if you have a pageable table and don't want that option to scroll out of sight.

Be careful when using abbreviations - as an (alleged) native English speaker, it took me a few minutes to infer that "VO" meant Value Object. And we have a lot of members who aren't normally thinking in English.

I do not recommend using NULL. NULL isn't data - it's the absence of data. It has a very bad habit of getting garbled when moved around - I've seen more than one database end up with the word "null" in a text field after someone had edited it where the original value was a null object. Plus in Java, primitives such as int and char cannot even have a null value. JSF tends to be very forgiving of null, but not all frameworks are so accomodating, and even in JSF there are pitfalls.

Treat null with the same respect as NaN - they're both very useful and very dangerous. You don't have to pad out an empty string with spaces - a simple "" will do, especially when rendering HTML, which tends to treat spaces rather casually anyway.

An IDE is no substitute for an Intelligent Developer.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Uh, for that you have validators.
I agree. Here's the link:
subject: First row to be empty inside a datatable
It's not a secret anymore!