Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Submit dataTable fields

 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I have a dataTable and I wish to submit the values.

But none of the dataTable values are submited, how should I do?

Would I have to write a dataTable instead of just giving the collection to the component? ( I saw this idea here http://www.coderanch.com/t/506763/JSF/java/multiple-selectOneMenu-values-inside-dataTable#2288586 )

I am using Primefaces with Mojara 2.04 and Glassfish.

Here it is the code of my dataTable:


Is there another way? Or I will have to the dataTable writed by myself?
 
Christopher Whu
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a similar question
my table looks like


it works perfectly fine with the f:setPropertyActionListener tag but what if i wanted to pass a qty of the item to add that has to be obtained from the field...

sadly i dont think you can put multiple h:form tags w/in the same datatable...
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert - you need a dataModel to decorate your row data with the cursor constructs needed to enumerate the rows in the table. That's why you can't bind the collection directly to the dataTable control.

Christopher - When you fire an action processor using a commandButton or commandLink on a row in a dataTable, you can find out which row was fired using the datamodel methods "getRowData()" and "getRowNumber()" - assuming I haven't remembered their names wrong. Again.

You can do forms inside a dataTable, but they have to obey standard XML tag/endtag matching rules. So you could wrap a form around a single column's items, for example. However, that's a bit much for most of us.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim Holloway
Thanks for you reply.

I googled trying to find some tutorial with dataModel and I could not find It, yet.

Do you have any tutorial? Or link to indicate?

Thanks! [=
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an old series of articles, but it's still relevant, and it really helped me when I was getting started. Google IBM Developerworks series "JSF For Nonbelievers" by Rick Hightower. He has a good example of a table/detail application.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic