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 like this "I don't
see my changes until the 2nd refresh!" a lot with folks using 2nd level
caches and not seeing immediate persistence of those changes.

On Tue, Jan 26, 2010 at 7:57 AM, Stéphane Jeanjean <
stephane.jeanj...@softeam.com> wrote:

>
> Please find my code just below :
>
>
> public class NewsListPage  {
>
>   protected static transient NewsDao myNewsDao;
>
>   public NewsListPage() {
>       PageableListView<News> news =
>       new PageableListView<News>("list", new NewsModel(), 15){
>
>           @Override
>           protected void populateItem(final ListItem<News> item) {
>               ourLogger.debug("Getting item value
> "+item.getModelObject().getTitle());
>
>               News news = item.getModelObject();
>                             item.add(new Label("date", new
> Model(news.getDate())));
>                             Link<News> l = new Link<News>("edit"){
>
>                   @Override
>                   public void onClick() {
>                       setResponsePage(new NewsPage(item.getModelObject()));
>                                         }
> };
>
>               item.add(l);
>               l.add(new Label("title", news.getTitle()));
>
>               item.add(new Link<News>("delete", new Model()){
>
>                   @Override
>                   public void onClick() {
>                       // TODO : check the refresh issue
>                       getNewsDao().delete(item.getModelObject());
>                       ourLogger.debug("News deleted");
>                                         }
>                                 });
>                         }
>
>                 };
>
>       add(news);
>       add(new OrPagingNavigator("navigator", news));
>             add(new BookmarkablePageLink<Void>("add", NewsPage.class));
>
>         }
>
>   /**
>    * Model for the news List to load the news from the db each time
>    *
>    */
>   public class NewsModel extends LoadableDetachableModel<List<News>> {
>
>       @Override
>       protected List<News> load() {
>           ourLogger.debug("Loading all news");
>           return new NewsDao().load();
>       }
>
>
>   }
>  }
>
>
>
> Jeremy Thomerson a écrit :
>
>  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 8:37 AM, Stéphane Jeanjean <
>> stephane.jeanj...@softeam.com> wrote:
>>
>>
>>
>>> 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
>>> wihtout
>>> this item.
>>>
>>> In the logs, it seems that the deletion in the onClick() method is called
>>> after the load of the page :(
>>>
>>> Somebody has an idea to avoid this manual refresh ?
>>>
>>> Thanks,
>>>
>>> Stéphane
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>

Reply via email to