You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ryan LaHue <ry...@gmail.com> on 2009/04/14 22:52:19 UTC
Retrieving/serializing the javascript for an AjaxLink
I am trying to embed javascript links in some JSON which I pass to Open
Flash Chart. I am able to test this by giving the "on-click" attribute of a
chart element the value of "alert('testing')" and it pops up the alert as I
expect. Now I need to create links to a Wicket page. All the links will go
to the same page but I need to have different parameters depending on which
element of my chart was clicked.
I tried something like this but got null for the markup stream:
AjaxLink lateLink = new AjaxLink ("late") {
public void onClick(AjaxRequestTarget target) {
setResponsePage(new CarPage(make, model, year));
return;
}
};
chart.setOnClick(lateLink.getMarkupStream());
How can I go about building a dynamic javascript link to a wicket page which
I can pass into the flash object? The chart object is just a bean which I
run through a converter to seralizize its attributes to JSON.
Thanks for any help.
Re: Retrieving/serializing the javascript for an AjaxLink
Posted by Jeremy Thomerson <je...@wickettraining.com>.
I think you'd be a lot better off doing urlFor(new
SomeLinkThatRedirectsToCarPage) rather than creating potentially many pages
per request.
--
Jeremy Thomerson
http://www.wickettraining.com
On Tue, Apr 14, 2009 at 4:45 PM, mallet <ry...@gmail.com> wrote:
>
> Figured it out.... Basically no need to use AjaxLink since I have to
> construct the javascript redirect manually.
>
> I ended up doing this:
> chart.setOnClick("window.location='" + RequestCycle.get().urlFor(new
> CarPage(make, model, year)) + "'");
>
>
> mallet wrote:
> >
> > I am trying to embed javascript links in some JSON which I pass to Open
> > Flash Chart. I am able to test this by giving the "on-click" attribute
> of
> > a
> > chart element the value of "alert('testing')" and it pops up the alert as
> > I
> > expect. Now I need to create links to a Wicket page. All the links will
> > go
> > to the same page but I need to have different parameters depending on
> > which
> > element of my chart was clicked.
> >
> > I tried something like this but got null for the markup stream:
> >
> > AjaxLink lateLink = new AjaxLink ("late") {
> > public void onClick(AjaxRequestTarget target) {
> > setResponsePage(new CarPage(make, model, year));
> > return;
> > }
> > };
> > chart.setOnClick(lateLink.getMarkupStream());
> >
> > How can I go about building a dynamic javascript link to a wicket page
> > which
> > I can pass into the flash object? The chart object is just a bean which
> I
> > run through a converter to seralizize its attributes to JSON.
> >
> > Thanks for any help.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Retrieving-serializing-the-javascript-for-an-AjaxLink-tp23047799p23048696.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Retrieving/serializing the javascript for an AjaxLink
Posted by mallet <ry...@gmail.com>.
Figured it out.... Basically no need to use AjaxLink since I have to
construct the javascript redirect manually.
I ended up doing this:
chart.setOnClick("window.location='" + RequestCycle.get().urlFor(new
CarPage(make, model, year)) + "'");
mallet wrote:
>
> I am trying to embed javascript links in some JSON which I pass to Open
> Flash Chart. I am able to test this by giving the "on-click" attribute of
> a
> chart element the value of "alert('testing')" and it pops up the alert as
> I
> expect. Now I need to create links to a Wicket page. All the links will
> go
> to the same page but I need to have different parameters depending on
> which
> element of my chart was clicked.
>
> I tried something like this but got null for the markup stream:
>
> AjaxLink lateLink = new AjaxLink ("late") {
> public void onClick(AjaxRequestTarget target) {
> setResponsePage(new CarPage(make, model, year));
> return;
> }
> };
> chart.setOnClick(lateLink.getMarkupStream());
>
> How can I go about building a dynamic javascript link to a wicket page
> which
> I can pass into the flash object? The chart object is just a bean which I
> run through a converter to seralizize its attributes to JSON.
>
> Thanks for any help.
>
>
--
View this message in context: http://www.nabble.com/Retrieving-serializing-the-javascript-for-an-AjaxLink-tp23047799p23048696.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org