Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

First row to be empty inside a datatable

 
Shasi Mitra
Ranch Hand
Posts: 101
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18009
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uh, for that you have validators.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic