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 <[email protected]> wrote:
> 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 js can use it as the key to store the state in map
> that lives in the cookie.
>
> -igor
>
> On Thu, Mar 22, 2012 at 2:45 PM, Dan Retzlaff <[email protected]> wrote:
>> 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 could probably make an "engineering compromise"
>> that works.
>>
>> There's probably an uglier jQuery solution that updates all link targets in
>> the page when your accordian gets clicked. :)
>>
>> On Thu, Mar 22, 2012 at 2:35 PM, Igor Vaynberg 
>> <[email protected]>wrote:
>>
>>> 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 <[email protected]>
>>> wrote:
>>> > 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 22, 2012 at 1:28 PM, Igor Vaynberg <[email protected]>
>>> wrote:
>>> >> 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 <
>>> [email protected]> wrote:
>>> >>> 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 state in the server.
>>> >>>
>>> >>> But it will be very heavy for the server, I mean, too many ajax
>>> >>> requests (one per click). I'm looking a NON-ajax solution.
>>> >>>
>>> >>> In the page we have links (grids with paginator, buttons, etc) Is
>>> >>> there a global solution that, no matter which link is clicked, it will
>>> >>> *always* send the component state? or maybe using cookies? thanks in
>>> >>> advance
>>> >>>
>>> >>> ---------------------------------------------------------------------
>>> >>> To unsubscribe, e-mail: [email protected]
>>> >>> For additional commands, e-mail: [email protected]
>>> >>>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: [email protected]
>>> >> For additional commands, e-mail: [email protected]
>>> >>
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: [email protected]
>>> > For additional commands, e-mail: [email protected]
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to