You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Charlie Dobbie <cf...@gmail.com> on 2008/12/04 13:53:44 UTC

setResponsePage + anchor

Hi,

I know you can set an anchor when you are coming from a Link component, but
how can I set an anchor without the Link?

>From a Button's onSubmit, I am calling setResponsePage with a Page instance,
and have a reference to a component on that page that I would like the
browser to jump directly to.  From my research so far, I don't believe this
to be possible, but easily could have missed something!

Is there a way to do this?

Regards,
Charlie.

Re: setResponsePage + anchor

Posted by kan <ka...@gmail.com>.
Take a look on this:
http://cwiki.apache.org/WICKET/faqs.html#FAQs-Howtoadd%2523anchor%2528opaque%2529topageurl%253F

2008/12/16 Charlie Dobbie <cf...@gmail.com>:
> Hi Janos,
>
> Thanks for your response.  That's an interesting solution to the problem!
>
> I have been digging through the setResponsePage etc code, trying to find a
> way to fit this into the framework directly, and have come up empty-handed.
> It would seem logical to me that there should be a way to specify either a
> String id or a Component directly inside the request target, but I can't see
> how to fit it in.
>
> It looks like your solution is the best available at the moment.
>
> Regards,
> Charlie.
>
>
>
> 2008/12/4 Cserep Janos <cs...@szeretgom.hu>
>
>> I'm doing it like this from my Page:
>>
>>  @Override
>>    public void renderHead(IHeaderResponse response) {
>>
>>        if (anchor != null) {
>>
>>            response.renderOnLoadJavascript("location.href='#" + anchor +
>> "';");
>>            anchor = null;
>>        }
>>    }
>>
>> Just have a setter for the anchor property on the Page instance you
>> pass to setResponsePage().
>>
>> janos
>>
>>
>> On Thu, Dec 4, 2008 at 1:53 PM, Charlie Dobbie <cf...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I know you can set an anchor when you are coming from a Link component,
>> but
>> > how can I set an anchor without the Link?
>> >
>> > From a Button's onSubmit, I am calling setResponsePage with a Page
>> instance,
>> > and have a reference to a component on that page that I would like the
>> > browser to jump directly to.  From my research so far, I don't believe
>> this
>> > to be possible, but easily could have missed something!
>> >
>> > Is there a way to do this?
>> >
>> > Regards,
>> > Charlie.
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
WBR, kan.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: setResponsePage + anchor

Posted by Charlie Dobbie <cf...@gmail.com>.
Hi Janos,

Thanks for your response.  That's an interesting solution to the problem!

I have been digging through the setResponsePage etc code, trying to find a
way to fit this into the framework directly, and have come up empty-handed.
It would seem logical to me that there should be a way to specify either a
String id or a Component directly inside the request target, but I can't see
how to fit it in.

It looks like your solution is the best available at the moment.

Regards,
Charlie.



2008/12/4 Cserep Janos <cs...@szeretgom.hu>

> I'm doing it like this from my Page:
>
>  @Override
>    public void renderHead(IHeaderResponse response) {
>
>        if (anchor != null) {
>
>            response.renderOnLoadJavascript("location.href='#" + anchor +
> "';");
>            anchor = null;
>        }
>    }
>
> Just have a setter for the anchor property on the Page instance you
> pass to setResponsePage().
>
> janos
>
>
> On Thu, Dec 4, 2008 at 1:53 PM, Charlie Dobbie <cf...@gmail.com>
> wrote:
> > Hi,
> >
> > I know you can set an anchor when you are coming from a Link component,
> but
> > how can I set an anchor without the Link?
> >
> > From a Button's onSubmit, I am calling setResponsePage with a Page
> instance,
> > and have a reference to a component on that page that I would like the
> > browser to jump directly to.  From my research so far, I don't believe
> this
> > to be possible, but easily could have missed something!
> >
> > Is there a way to do this?
> >
> > Regards,
> > Charlie.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: setResponsePage + anchor

Posted by Cserep Janos <cs...@szeretgom.hu>.
I'm doing it like this from my Page:

 @Override
    public void renderHead(IHeaderResponse response) {

        if (anchor != null) {

            response.renderOnLoadJavascript("location.href='#" + anchor + "';");
            anchor = null;
        }
    }

Just have a setter for the anchor property on the Page instance you
pass to setResponsePage().

janos


On Thu, Dec 4, 2008 at 1:53 PM, Charlie Dobbie <cf...@gmail.com> wrote:
> Hi,
>
> I know you can set an anchor when you are coming from a Link component, but
> how can I set an anchor without the Link?
>
> From a Button's onSubmit, I am calling setResponsePage with a Page instance,
> and have a reference to a component on that page that I would like the
> browser to jump directly to.  From my research so far, I don't believe this
> to be possible, but easily could have missed something!
>
> Is there a way to do this?
>
> Regards,
> Charlie.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org