Well, I think it is because this is the same listview that is redisplayed, not the new one. The cause is that you did not add the new listview to its parent.
But, I would have done a little bit differently because: 1/ You do not have to recreate the listview in ajaxlink's onclick. just clear cookies and reattach the listview's parent-container 2/ You do not have - generally speaking - to detach you model yourself and, moreover, it is not interesting to do it in the same request cycle. It should be end at the end of the previous cycle. The use of a LDM does this for you. So: just one ListView with a LDM, and it should be good. If it's still not, maybe the persistence of the cookie update is a little bit "slow" and IO-async... But I (means myself) could not help in a such case. Best regards, Sebastien. On Thu, Dec 6, 2012 at 11:41 PM, Corbin, James <jcor...@iqnavigator.com>wrote: > The ListView is not in a form, which is why I am leaving the default for > setReuseItems to false. > I am using a LoadableDetachableModel and verified the load that rereads > the cookies, does in fact get called after I delete them (reset method > call below). If I break in the load of the detachable model, it is > reading that there are still values for the cookies I deleted in the > previous step. > > Basically, here is the body of my Ajax Link's onClick, > > RecentlyViewedItemsCollection c = new > RecentlyViewedItemsCollection(util.getCurrentUser()); > c.reset(); // this actually deletes all > the cookies > getModel().detach(); // this forces the > detachable model to call its > load, which attempts to re-read specific cookies that should no longer > exist > > target.add(RecentlyViewedItemsPanel.this.get("itemContainer")); // > lastly, I refresh the parent (WebMarkupContainer) of the ListView > > I would have expected that when the model's load method is called that it > would see that the cookies were removed, but it still finds them. > > J.D. > > > > > > > > > On 12/6/12 3:29 PM, "Sebastien" <seb...@gmail.com> wrote: > > >Hi, > > > >Be sure to use a LoadableDetachableModel > >Also, maybe you set ListView#*setReuseItems* to true (because the ListView > >is in a form)? You can set it to false if you have no validation and then > >you will get fresh data (see ListView javadoc) > > > >Hope this helps, > >Sebastien. > > > >On Thu, Dec 6, 2012 at 11:09 PM, Corbin, James > ><jcor...@iqnavigator.com>wrote: > > > >> I have a ListView that renders items that are populated from user cookie > >> data. The ListView contains a "clear" action that is supposed to delete > >> the cookies then refresh the ListView so it reflects that the cookie > >>data > >> was removed. I have code that executes the deletion of the cookies > >> (works), then I turn around and detach the ListView's model which > >>triggers > >> a rereading of the cookie data. For some reason (probably works as > >> designed), when the model is detach and reloads the cookies, they are > >>still > >> present. > >> If I then force a page refresh, cookie data is in fact removed and the > >> ListView is empty. > >> > >> Is there a way to attain this? Am I missing something? I really don't > >> want to have to reload the page to see that the cookie data has been > >> removed. > >> > >> J.D. > >> > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >