Re: Deleting Cookies
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.comwrote: 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.
Re: Deleting Cookies
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.comwrote: 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
Re: Deleting Cookies
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.comwrote: 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.comwrote: 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
Re: Deleting Cookies
Hi Sebastian, Thanks for your feedback. I wasn't recreating (semantics?) the Listview, I was just refreshing it via ajax so it updates with the model changes. What do you mean by reattach the listview's parent-container? Do you mean remove the listview and re-add it in the onbeforerender? J.D. On 12/6/12 4:16 PM, Sebastien seb...@gmail.com wrote: 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.comwrote: 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.comwrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Deleting Cookies
Oops, you are right: I misread. I though you was recreating the listview, sorry for he confusion! Also, reattach the listview's parent-container simply means what you already do by: target.add(RecentlyViewedItemsPanel.this.get(itemContainer)); (this is because it is not possible to reattach the listview directly but you already knew that) Well, as I said earlier, maybe is it a cookie/IO issue. I mean: the fact of deleting and persisting changes in the cookie may be IO-asynchronous and then the model is updated before changes are persisted... I hope someone can help you on that subject... Best regards, Sebastien. On Fri, Dec 7, 2012 at 12:28 AM, Corbin, James jcor...@iqnavigator.comwrote: Hi Sebastian, Thanks for your feedback. I wasn't recreating (semantics?) the Listview, I was just refreshing it via ajax so it updates with the model changes. What do you mean by reattach the listview's parent-container? Do you mean remove the listview and re-add it in the onbeforerender? J.D. On 12/6/12 4:16 PM, Sebastien seb...@gmail.com wrote: 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.comwrote: 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.comwrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Deleting Cookies
Corbin, James 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. Have you confirmed that the cookie store is updated on AJAX requests? (a) are the updated cookies sent, and (b) are they made available properly for your app code; i.e., don't use some previously cached values? I'd wireshark the request and then step through the cookie gathering code to check what values are sent in the AJAX request and where the load() method gets its values from. Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jsch...@acm.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org