So, I've ended up with this solution:

https://gist.github.com/xfyre/7369149

It kinda works. There are few things I don't like about it:

- it uses InternalComponentResources (which is, in fact, internal interface
not exposed as a public API)
- currently it supports only EventLink (though it may be easily extended to
use with ActionLink as well)
- if user loads an URL from browser history (or enters address into
location bar), we still have to load the page with it's default state and
THEN update relevant zone, which results in two consecutive requests

Any suggestions how to improve it are kindly appreciated.



On Wed, Nov 6, 2013 at 6:41 AM, Ilya Obshadko <ilya.obsha...@gmail.com>wrote:

> Yes, that looks much better than what I've originally proposed. Thanks.
>
>
> On Tue, Nov 5, 2013 at 11:22 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
>> On Tue, 05 Nov 2013 17:11:17 -0200, Ilya Obshadko <
>> ilya.obsha...@gmail.com> wrote:
>>
>>  I've researched this problem a little bit and have an interesting
>>> question.
>>>
>>> I would like to have a customized version of ActionLink (let's call it
>>> HashActionLink). It should work as follows:
>>>
>>> - if client-side JavaScript is enabled (and thus history events work), it
>>> reacts to hash change events and updates specified zone
>>> - if client-side JavaScript is disabled, it falls back to normal
>>> ActionLink
>>> behavior
>>>
>>> I suppose it might be handled using JS DOM manipulation in @AfterRender
>>> phase.
>>> Are there any other options to do that?
>>>
>>
>> You can do this with an ordinary ActionLink or EventLink and do the logic
>> you describe in JavaScript, listening to clicks to the link and stopping
>> its propagation so the browser doesn't do the normal link behavior. For
>> monitoring hash changes, you can try some JavaScript library that can do
>> that.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Tapestry, Java and Hibernate consultant and developer
>> http://machina.com.br
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Reply via email to