You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Tan CyberT@n" <qu...@gmail.com> on 2009/03/08 13:24:14 UTC
how to let actionlink to open another page like target="_blank"?
Hi,
I have a question about actionlink, is there any possible to make it to open
another new page instead of change in current page?
make it something like <a href="xxxxx" target="_blank"> ?
Thank you.
Regards,
Tan
Re: how to let actionlink to open another page like target="_blank"?
Posted by Inge Solvoll <in...@gmail.com>.
Enjoy :)
As you can see, this is accomplished with only a few lines of actual code.
Of course, it is easy to extend with parameters to open up event type,
window attributes and so on... So far, I don't need anything like that.
PopupPageLink.java:
@IncludeJavaScriptLibrary("PopupPageLink.js")
public class PopupPageLink {
@Inject
private ComponentResources resources;
@Environmental
private RenderSupport renderSupport;
@InjectContainer
private ClientElement container;
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String page;
@Parameter
private Object[] context;
void afterRender() {
Link link = resources.createPageLink(page, true, context);
renderSupport.addScript("new PopupPageLink('%s', '%s');",
container.getClientId(), link);
}
}
PopupPageLink.js:
var PopupPageLink = Class.create();
PopupPageLink.prototype = {
initialize: function(id, link) {
this.element = $(id);
this.link = link;
Event.observe(this.element, 'click',
this.onclick.bindAsEventListener(this));
},
onclick: function() {
var width = 800;
var height = 600;
var name = 'dialogWindow';
var win = window.open(this.link,name,'width=' + width + ',height=' +
height +
',resizable=yes,scrollbars=yes,menubar=no,screenX=0,screenY=0,left=0,top=0'
);
win.focus();
}
}
On Sun, Mar 8, 2009 at 6:49 PM, Tan CyberT@n <qu...@gmail.com>wrote:
> Yes Please.
>
> On Sun, Mar 8, 2009 at 11:23 PM, Andy Pahne <andy.pahne@googlemail.com
> >wrote:
>
> >
> > Yes please, would be nice to see...
> >
> > Andy
> >
> >
> > Inge Solvoll schrieb:
> >
> >> I created a mixin, PopupPageLink, that opens a new window containing a
> the
> >> link, with window.open() in javascript. It gives you more control over
> the
> >> opened window. Also, you can add the mixin to any element, not just a
> >> link,
> >> just make a hook to the onclick event.
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
Re: how to let actionlink to open another page like target="_blank"?
Posted by "Tan CyberT@n" <qu...@gmail.com>.
Yes Please.
On Sun, Mar 8, 2009 at 11:23 PM, Andy Pahne <an...@googlemail.com>wrote:
>
> Yes please, would be nice to see...
>
> Andy
>
>
> Inge Solvoll schrieb:
>
>> I created a mixin, PopupPageLink, that opens a new window containing a the
>> link, with window.open() in javascript. It gives you more control over the
>> opened window. Also, you can add the mixin to any element, not just a
>> link,
>> just make a hook to the onclick event.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: how to let actionlink to open another page like target="_blank"?
Posted by Andy Pahne <an...@googlemail.com>.
Yes please, would be nice to see...
Andy
Inge Solvoll schrieb:
> I created a mixin, PopupPageLink, that opens a new window containing a the
> link, with window.open() in javascript. It gives you more control over the
> opened window. Also, you can add the mixin to any element, not just a link,
> just make a hook to the onclick event.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: how to let actionlink to open another page like target="_blank"?
Posted by Inge Solvoll <in...@gmail.com>.
I created a mixin, PopupPageLink, that opens a new window containing a the
link, with window.open() in javascript. It gives you more control over the
opened window. Also, you can add the mixin to any element, not just a link,
just make a hook to the onclick event.
Let me know, and I'll post the code. It's very simple :)
On Sun, Mar 8, 2009 at 2:38 PM, ningdh <ni...@gmail.com> wrote:
> Just add target="_blank" to actionlink.
>
> <a href="#" t:type="actionlink" target="_blank">XX</a>.
>
>
> DH
>
> Sent: Sunday, March 08, 2009 8:24 PM
> Subject: how to let actionlink to open another page like target="_blank"?
>
>
> > Hi,
> >
> > I have a question about actionlink, is there any possible to make it to
> open
> > another new page instead of change in current page?
> > make it something like <a href="xxxxx" target="_blank"> ?
> > Thank you.
> >
> > Regards,
> > Tan
> >
>
Re: how to let actionlink to open another page like target="_blank"?
Posted by ningdh <ni...@gmail.com>.
Just add target="_blank" to actionlink.
<a href="#" t:type="actionlink" target="_blank">XX</a>.
DH
Sent: Sunday, March 08, 2009 8:24 PM
Subject: how to let actionlink to open another page like target="_blank"?
> Hi,
>
> I have a question about actionlink, is there any possible to make it to open
> another new page instead of change in current page?
> make it something like <a href="xxxxx" target="_blank"> ?
> Thank you.
>
> Regards,
> Tan
>