File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Primefaces tree update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Primefaces tree update" Watch "Primefaces tree update" New topic

Primefaces tree update

timo talja

Joined: Nov 19, 2013
Posts: 1
just a basic question - gurus stand by for an answer a beginner can understand....
--> I have a menuitem tree view (T) and from that an dialog (D) can be opened. Great.
--> on that opened dialog user can submit a deletion where some of those original rows which appeared on that tree (T) existed are beeing erased.

Question - how on earth can I update that tree (T) on the backgroud when making actions with dialog (D) ? Or is it possible ?
- If simultaneous update on both T and D is impossible, how do I update T when exiting D ?

K. Tsang

Joined: Sep 13, 2007
Posts: 3130

Welcome to the Ranch

Are you sure you want to use a dialog? Isn't it possible to have the tree on one side and the editable content in a panel on the other side?

When changing the data in the panel the tree gets updated. Also the backing bean controls or manages when the tree gets refreshed (eg like every operation). For simplicity, the managed bean should be in ViewScope.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

The dialog just needs to fire off an AJAX request that re-renders the underlying tree. The user's browser will handle the sordid graphical details automatically.

View Scope is OK, but more persistent scopes (such as session scope) are OK, too. Request Scope is useless. But then Request Scope is almost always useless no matter what you do in JSF. It doesn't provide a stable Model for the MVC mechanisms to use.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Primefaces tree update
It's not a secret anymore!