0

I have a project I am working on that uses Primefaces 3.2, JSF 2.0.3, and JBoss 6.1. I also use the latest version of Openfaces (I finally found a PF version of BorderLayoutPanel so I might be getting rid of OF).

My situation is I have these buttons in a panel grid->row - Add, Edit, Delete, and Cancel. If I click on Add, then the Edit and Delete buttons are replaced with an Save button. The only buttons showing are Save and Cancel. I could always add all possible buttons to the view and then toggle the rendered= with backing bean code, but is there a more elegant way to do this? The rendered= code in the backing bean could get ugly real quick and I'm not sure I like the way Primefaces sometimes generates all sorts of life cycle changes. I had a recent datatable execute the value= 21 times just from selecting a row (Openfaces actually did this correctly by calling it one time).

Big Al
  • 481
  • 1
  • 7
  • 14
  • Using `rendered` attribute is the most simple way. The code will get ugly if you make it ugly. Primefaces doesn't generate any strange lifecycle changes, it's all JSF 2.0 thing. If your value has been executed/changed 21 times then you use it in some `UIData` components or something like that and it is completely fine to call getter many times if you don't execute (which you really should not) any bussines logic in it. You can specify buttons programatically but you will get in more troubles then with `rendered` attribute. [eg like this](http://stackoverflow.com/q/10429893/1317692) – Fallup May 16 '12 at 21:21
  • Ok thanks for the info. What I did with the Primefaces Datatable to improve performance was to take the call to the DAO from the value= expression and place it in the init method with the @PostConstruct annotation. That way the call to the tables will occur after the managed bean has been created and the data manager has been injected by Spring. That also means I will need a way to refresh the data later on, but that's outside the scope of my original question. – Big Al May 17 '12 at 13:45

0 Answers0