• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

binding in a datatable

 
Men rai
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a datatable that reads registers from a database.
Into the datatable I have a panelgroup that is populated by binding
My problem is that I can not pass a parameter. I want to pass a value from the datatable var, in that case preg, on each row I want to know the value of the register read to populate the panelgroup.
If I display the value it works fine for each row: #{preg.idpreg}


<h:dataTable var="preg" value="#{Pregbacking.list(Pregbacking.idenq)}">
<h:column>
#{preg.idpreg}
<h:panelGroup binding="#{Pregbacking.dynamicDataTableGroup(preg.idpreg)}"/>
</h:column>
</h:dataTable>

Does anybody know how can I solve this ??
Thanks in advance.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're attempting to put logic in your View. That's bad MVC. MVC should display what's in the Model, not attempt to program the Model. Aside from everything else, why use a Separation of Concerns pattern if you're not actually going to keep the Concerns separated?

It's a popular misconception that the Model on a dataTable should always be the original persistent Domain Model. But that's limiting yourself. In cases like this, it's better to make the model be a fa├žade or decorator for the actual domain model objects. That way you can do the necessary logic when you build the Model and the View merely needs to display the Model with no logic required in the View.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic