Just an idea:

if the panel holds a model pointing to a ProductReference instance, you can
change the underlying model.


targetUpdatePanel.modelChanging();

targetUpdatePanel.setModel(new ProductReferenceLoadableDetachableModel(prod));

targetUpdatePanel.modelChanged();





On Wed, Nov 24, 2010 at 11:48 AM, Arjun Dhar [via Apache Wicket] <
ml-node+3057421-1014270419-65...@n4.nabble.com<ml-node%2b3057421-1014270419-65...@n4.nabble.com>
> wrote:

> Hi,
>  I have a Tree (representing a product line) and an adjacent Panel
> representing Product listing within a category/line.
>
> On click of the Link the Panel updates. I have the following code, all
> works except am not sure how to go about refreshing the Panel with updated
> DataModel:
>
> ... In following code: See " //TODO: Not sure how to update Panel with
> latest Product". So on click I am getting the correct object in "Prod"
> (ProductReference). However I'm failing to translate that into updating the
> Panel Model & Refreshing the Panel on UI more importantly.
>
>       @Override
>       protected final LinkTree createLinkTree(String id, TreeModel treeModel) 
> {
>               return new LinkTree(id, treeModel) {
>                       //node = Name of Link
>                       protected final void onNodeLinkClicked(Object node, 
> BaseTree tree, AjaxRequestTarget target) {
>                               Object o = 
> ((DefaultMutableTreeNode)node).getUserObject();
>                               if (o instanceof ProductReference) {
>                                       ProductReference prod = 
> (ProductReference)((DefaultMutableTreeNode)node).getUserObject();
>                                       log.info("[createLinkTree] " + prod);
>                                       
>                                         targetUpdatePanel.setVisible(true);
>                                         //TODO: Not sure how to update Panel 
> with latest Product
>                               }
>                       }
>  ...
>
>
>
> (targetUpdatePanel.setVisible(true); is used because initially the Panel is
> blank when nothing is selected & placeholder markup is used -- FYI)
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/Ajax-Panel-Update-tp3057421p3057421.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com<ml-node%2b1842946-398011874-65...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>



-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Panel-Update-tp3057421p3057473.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to