Need help in refreshing panel..

2012-09-16 Thread kshitiz
Hi,

I am facing a problem in refreshing a panel. The requirement is I have a
panel A which has Panel B. Panel A carries list of LDM which is being passed
to Panel B. 

public class PanelA {

   private LoadableDetachableModelListlt;PostDomain
*detachablePostDomainList *= new
LoadableDetachableModelListlt;PostDomain() {


protected ListPostDomain load() {
return new ArrayListPostDomain();
}
};

public PanelA() {
*this.setOutputMarkupId(true);*
detachablePostDomainList = new
LoadableDetachableModelListlt;PostDomain() {
/**
 * 
 */
private static final long serialVersionUID = 1L;

@Override
protected ListPostDomain load() {
return new List();
}
};

}

*final PanelB panelB= new PanelB(B,
detachablePostDomainList, PanelA.this);
showPostPanel.setOutputMarkupPlaceholderTag(true);
*

IndicatingAjaxButton ajaxPostSubmitButton = new IndicatingAjaxButton(
submitPost, postForm) {
 // some operations

public void onSubmit(AjaxRequestTarget target, final 
Form? form) {
if (target != null) {
target.add(PanelA.this);

}

}


};


}

In the above scenario, when I refresh panelA from itself by pressing
ajaxPostSubmitButton, LDM list is getting updated but when I refresh PanelA
from PanelB, nothing happens. What is the reason? I am refreshing PanelA
from PanelB using the same manner. 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-in-refreshing-panel-tp4652014.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



Re: Need help in refreshing panel..

2012-09-16 Thread kshitiz
The problem is now even more complicated as PanelA is not getting refreshed
from PanelB at once. But when I do some operation in PanelB again, PanelA is
then refreshed...

Here is PanelB:

Public class PanelB{


public PanelB(PanelA panelA) {
PostDeleteButtonPanel postDeleteButtonPanel = new PostDeleteButtonPanel(
postDeleteButtonPanel, 
postForm) {


protected void 
onConfirm(AjaxRequestTarget target) {
try {
//  some operation
if (target != null)

*target.add(panelA);*

} catch (Exception exception) {

exception.printStackTrace();
}

}

};

}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-in-refreshing-panel-tp4652014p4652016.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



Re: Need help in refreshing panel..

2012-09-16 Thread Sven Meier

You have to remember that a LDM is loaded once per request cycle only.

If you change the backing list (e.g. on delete of an item) *after* the 
LDM was already accessed (e.g. a link in a ListView), you have to detach 
the model once, so it is loaded again:


   // some operation calling getObject() on the LDM
   ...

   ldm.detach();

   target.add(component)

Hope this helps
Sven


On 09/16/2012 04:08 PM, kshitiz wrote:

The problem is now even more complicated as PanelA is not getting refreshed
from PanelB at once. But when I do some operation in PanelB again, PanelA is
then refreshed...

Here is PanelB:

Public class PanelB{


public PanelB(PanelA panelA) {
PostDeleteButtonPanel postDeleteButtonPanel = new PostDeleteButtonPanel(
postDeleteButtonPanel, 
postForm) {


protected void 
onConfirm(AjaxRequestTarget target) {
try {
//  some operation
if (target != null)

*target.add(panelA);*

} catch (Exception exception) {

exception.printStackTrace();
}

}

};

}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-in-refreshing-panel-tp4652014p4652016.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




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



Re: Need help in refreshing panel..

2012-09-16 Thread kshitiz
Hey...that workedbut still I didn't understand how it worked. I am not
calling detach method in ajaxPostSubmitButton of PanelA. So how come it is
getting refreshed. I am just trying to understand the concept



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-in-refreshing-panel-tp4652014p4652018.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



Re: Need help in refreshing panel..

2012-09-16 Thread Sven Meier
It depends whether the LDM is accessed *before* you change something in 
the backing list.


Note that events handled by components in a ListView will trigger 
loading of the LDM as soon as you access the component's model.


Sven

On 09/16/2012 05:48 PM, kshitiz wrote:

Hey...that workedbut still I didn't understand how it worked. I am not
calling detach method in ajaxPostSubmitButton of PanelA. So how come it is
getting refreshed. I am just trying to understand the concept



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Need-help-in-refreshing-panel-tp4652014p4652018.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




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