Adding Empty Rows to DataTable

UI Components for JSF
Post Reply
Ravi2000
Posts: 3
Joined: 09 Dec 2011, 12:46

09 Dec 2011, 15:14

Hi all,I am new to primefaces.I want to ask if there is any way out to add empty rows in DataTable without putting ant empty records in Backing Bean.I want backing bean to contain only real data and no dummy empty records,still,for the look and feel purpose,I want to add ceratain empty rows in dataTable.Is that possible through jQuery or any other method?

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

10 Dec 2011, 00:45

Click following URL, and that code should help you implement something like the add() method on that page, and use the Item attribute, too, which is necessary, if you use his approach. I recommend you read that entire blog as well as other blogs on his blogspot site. :)

http://balusc.blogspot.com/2010/06/bene ... SimpleCRUD

Also, you might want to ask these type of questions in Community > PrimeFaces Core (URL below).

viewforum.php?f=3
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Ravi2000
Posts: 3
Joined: 09 Dec 2011, 12:46

12 Dec 2011, 07:59

Hi Smith,
Thanks for the reply.But this is not what I wanted.As I told,I want to add empty rows with the help of some code on the client side,I don't want to add unnecessary records on the server side just for adding empty records.In the blog,add method is on server side which adds other empty rows,This is not what I wanted.

Lyrionus
Posts: 60
Joined: 31 Aug 2011, 09:09

12 Dec 2011, 12:14

My guess is it isn't really possible to add emtpy rows only to the front-end. At the moment we are doing it by adding a empty object to the back-end and on posts check for empties and delete them so they won't end up in the database.
JSF 2.0
Primefaces 3.2
Tomcat 7.0

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

12 Dec 2011, 18:53

Ravi2000 wrote:Hi Smith,
Thanks for the reply.But this is not what I wanted.As I told,I want to add empty rows with the help of some code on the client side,I don't want to add unnecessary records on the server side just for adding empty records.In the blog,add method is on server side which adds other empty rows,This is not what I wanted.
Okay/understood. I prefer coding JSF over jquery. Click URL below and go to related links on the right side of the page, if necessary.

http://stackoverflow.com/questions/5136 ... e-jeditabl
Lyrionus wrote:My guess is it isn't really possible to add emtpy rows only to the front-end. At the moment we are doing it by adding a empty object to the back-end and on posts check for empties and delete them so they won't end up in the database.
@Lyrionus, i "like" this response, but (I think) BalusC's blog/example had the new/empty row as a separate object that existed outside of the dataTable, if I recall, correctly. I'm not using that approach, but I like that approach, too.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 29 guests