aspose file tools*
The moose likes JSF and the fly likes Data table with empty data and fixed size. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Data table with empty data and fixed size." Watch "Data table with empty data and fixed size." New topic
Author

Data table with empty data and fixed size.

Janardhan Chowdary
Greenhorn

Joined: May 21, 2012
Posts: 15

Hi Friends,
I need to implement a data table by using primefaces.
The table should not contain any data initially and some empty rows should be there.
And the rows are able to edit and save.

Thank you,
Janardhan


He who cannot obey himself will be commanded. That is the nature of living creatures.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

Welcome to the JavaRanch, Janardhan!

The UI view of the dataTable reflects the contents of that dataTable's corresponding DataModel object. Therefore to display a table with a fixed number of empty rows, you must create a DataModel that contains that number of empty row model objects.

If you wish to edit/save rows, do not take the common shortcut of using a Collection or array as a DataModel. Use an actual javax.faces.DataModel class object such as a ListDataModel or ArrayDataModel. The DataModel classes decorate the underlying data with extra location information that permits the action logic to know which row the user is acting on.


Customer surveys are for companies who didn't pay proper attention to begin with.
Janardhan Chowdary
Greenhorn

Joined: May 21, 2012
Posts: 15

Hi Tim,

Thanks for your quick response with a better solution.

Have a nice day!

Regards,
Janardhan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Data table with empty data and fixed size.