Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying data based on if-else condition

 
Anil Gorthy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

My application is a standard MVC app which uses Apache Trinidad as its front-end. Here is my requirement: based on the parameters selected from the list boxes in the UI, I need to display a tabular data w/ edit and delete buttons if there is data in the DB else, need to accept input from the user.

I am not sure how I can accomplish this - do I create a <tr:switcher> that will be set (programmatically) in the backing bean based on whether there is data or not for the selected parameters?

Thanks in advance for your help!
 
Tim Holloway
Bartender
Posts: 18419
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You haven't made yourself totally clear here, but what I think you're saying is that you want a table display with optional buttons per row based on the value of the data for that row.

You can do that with just the core JSF and don't need Trinidad's help. The key is not to do like most people do and confuse the dataModel with the underlying data. Sometimes you get better results if you decorate the rows in the dataModel with additional properties that can be queried for things like this. When you do that, you can use them as arguments to the "rendered" attributes of the buttons in question. Like so:
 
Anil Gorthy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your understanding of my requirement is correct, Tim. Thank you!

I was not using DataModel and hence was struggling to capture the selected row to perform either edit or delete of that row.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!