Re: keep component state?

2012-03-22 Thread Alfonso Quiroga
Thanks to both Igor and Dan. I already thougth on jquery solution (I'm using jQuery) changing ALL the links, but I think it is not a happy solution. Tomorrow at work I will fight with cookies and js, which is a good idea. Thanks again!! On Thu, Mar 22, 2012 at 7:00 PM, Igor Vaynberg wrote: > if a

Re: keep component state?

2012-03-22 Thread Igor Vaynberg
if a cookie is used then no server side interaction is required. javascript can read the cookie itself and restore state all on client side. as far as naming the cookie, its not terribly hard. name the coookie "accordion". assign each accordian a guid on serverside and push it to clientside where

Re: keep component state?

2012-03-22 Thread Dan Retzlaff
I thought Alfonso's cookie suggestion sounded workable. Have JS keep the current accordian state there, and you can grab it server-side in your accordion's onBeforeRender. A cookie naming strategy that works generally might be tricky (does it include the page mount? version? component ID?). But you

Re: keep component state?

2012-03-22 Thread Alfonso Quiroga
Igor: I agree 100%. My question was thinking something (maybe impossible) that, no matter which link you click, it will always send the accordion (or any other componenent) state. Maybe it is not possible because i.e. a normal link only requests a new url generated by Wicket, and I don't see the wa

Re: keep component state?

2012-03-22 Thread Igor Vaynberg
ah. well, if you want it to be preserved across link clicks then you have to keep the state on the server. you wouldnt have to if the links were ajax and were not repainting the accordion. -igor On Thu, Mar 22, 2012 at 2:33 PM, Alfonso Quiroga wrote: > Are you sure when the page changes the has

Re: keep component state?

2012-03-22 Thread Alfonso Quiroga
Are you sure when the page changes the hash is keeped? Maybe I did not express correctly, when I typed "refresh the page" I wanted to say "when you click a link and wicket renders the page again". I think when you click any link, a new url is generated without the hash. Thanks anyway On Thu, Mar 2

Re: keep component state?

2012-03-22 Thread Igor Vaynberg
add the state to the hash of the page. and when initializing accordion check the hash and restore it. this should survive page refreshes. -igor On Thu, Mar 22, 2012 at 7:20 AM, Alfonso Quiroga wrote: > Hi, in my job we are using wicket and I've made some components like > Accordion, etc. The pr

keep component state?

2012-03-22 Thread Alfonso Quiroga
Hi, in my job we are using wicket and I've made some components like Accordion, etc. The problem is, when the page refreshes, the accordion state is reseted. I think I can develop this solution: * every time the users clicks in a accordion tab, an AJAX request is made, to mantain the component sta