Re: Page load after an action

2010-01-27 Thread Pedro Santos
It is natural: 1 - model load some data from some source 2 - that source was updated, changed, and the data loaded on the model no more reflect the data on that source 3 - detach the old loaded data on model 4 - next time any object require the data on model, it will no longer have the old data

Page load after an action

2010-01-26 Thread Stéphane Jeanjean
Hello, My page displays a list of items, for each of them, an icon is available to delete it. The action is managed in a Link.onClick() method. When I click on the link, the page is refreshed but the item is always in my list, I have to do refresh again manually the page to have a list

Re: Page load after an action

2010-01-26 Thread Jeremy Thomerson
You're probably not using models correctly - specifically for your list view. You could post some code, but make sure that you're reloading the data for the list view after the onClick is called and the item is deleted. -- Jeremy Thomerson http://www.wickettraining.com On Tue, Jan 26, 2010 at

Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean
Please find my code just below : public class NewsListPage { protected static transient NewsDao myNewsDao; public NewsListPage() { PageableListViewNews news = new PageableListViewNews(list, new NewsModel(), 15){ @Override protected void

Re: Page load after an action

2010-01-26 Thread Riyad Kalla
Stephane, I'll let someone smarter than me address the wicket issue of removing the item from the ListView and seeing if that helps -- but is there a chance you are using Hibernate and the Level 2 ehcache plugin or any 2nd-level caching with your persistence code? I ask because I've seen code

Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean
Hi, I don't use Hibernate. My persistence layer uses JDBC. What is strange when I click the delete link, it's the logs order : Loading all news News deleted So it seems that the deletion is done after the data reload :( Stéphane Riyad Kalla a écrit : Stephane, I'll let someone smarter

Re: Page load after an action

2010-01-26 Thread Pedro Santos
Call news.getDefaultModel().detach(), and look for more info about detachable models. http://cwiki.apache.org/WICKET/detachable-models.html On Tue, Jan 26, 2010 at 1:35 PM, Stéphane Jeanjean stephane.jeanj...@softeam.com wrote: Hi, I don't use Hibernate. My persistence layer uses JDBC.

Re: Page load after an action

2010-01-26 Thread Pedro Santos
missing line: call detach method just after delete your item. On Tue, Jan 26, 2010 at 1:41 PM, Pedro Santos pedros...@gmail.com wrote: Call news.getDefaultModel().detach(), and look for more info about detachable models. http://cwiki.apache.org/WICKET/detachable-models.html On Tue, Jan 26,

Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean
The behaviour is the same with the following code :( public void onClick() { // TODO : check the refresh issue getNewsDao().delete(item.getModelObject()); ourLogger.debug(News deleted);

Re: Page load after an action

2010-01-26 Thread Pedro Santos
by calling getDefaultModel inside onClick, you get an reference to the link component model. You need to detach the model on your list view. You has an reference to it on your variable news. So: news.getDefaultModel().detach() If you need, you can change that variable modifiers or turn it an

Re: Page load after an action

2010-01-26 Thread Stéphane Jeanjean
Thanks Pedro, it's ok now ;-) I use LoadableDetachableModel to avoid the call to detach() method. It does not seem that is the right way. Somebody can explain me why ? Stéphane Pedro Santos a écrit : by calling getDefaultModel inside onClick, you get an reference to the link component

Re: Page load after an action

2010-01-26 Thread Riyad Kalla
Seems weird to me as well that 'detach' has to be explicitly called. Also still curious why Stephane was seeing the log ordering he did when the link was clicked: Loading all news News deleted I'd expect to see news deleted first, from his onClick handler then the

Re: Page load after an action

2010-01-26 Thread James Carman
Doesn't it have to load the model so that it knows what item it's talking to? On Tue, Jan 26, 2010 at 2:12 PM, Riyad Kalla rka...@gmail.com wrote: Seems weird to me as well that 'detach' has to be explicitly called. Also still curious why Stephane was seeing the log ordering he did when the

Re: Page load after an action

2010-01-26 Thread Jeremy Thomerson
Yes - James is right here - it's a loadable detachable model - so it needs to load the data in order to repopulate the list before deleting the item. My guess is either you need to call the detach so that on the re-render it gets reloaded, or you need to make sure your delete is being committed

Re: Page load after an action

2010-01-26 Thread James Carman
Or, call detach(), then call modelChanged()? On Tue, Jan 26, 2010 at 4:02 PM, Jeremy Thomerson jer...@wickettraining.com wrote: Yes - James is right here - it's a loadable detachable model - so it needs to load the data in order to repopulate the list before deleting the item. My guess is