If you want to allow both clicks and new tab clicks, try this:
Render an anchor tag with the history token as the href:
<a href="#myToken">Click Me</a>
In your Cell, catch the click event and do the following:
- If shift or ctrl is pressed, ignore the event. The user is opening a
new window.
- If the right button was pressed, ignore the event. The user will see
the context menu.
- If the left button was pressed, call Event.preventDefault() to prevent
the page reload in IE, then call History.newItem("myToken").
Thanks,
John LaBanca
[email protected]
On Mon, Mar 14, 2011 at 6:45 PM, Greg Dougherty
<[email protected]>wrote:
> Does that allow for right-clicking? Because high on my list of "HTML
> Tricks the piss me off" is when websites have javascript "links"
> rather than real links that I can select, and do an "Open New Tab" /
> "Open New Window".
>
> Greg
>
> On Mar 14, 9:58 am, John LaBanca <[email protected]> wrote:
> > You can render an anchor tag with a no-op href:
> > <a href="javascript:;">Click Me</a>
> >
> > In your Cell, catch the click event and call History.newItem("myToken").
> > This is basically what the Hyperlink Widget does.
> >
> > Thanks,
> > John LaBanca
> > [email protected]
> >
> > On Sat, Mar 12, 2011 at 1:07 PM, Jake <[email protected]> wrote:
> > > I want to create a CellTable with a column of Hyperlinks.
> > > I'm trying to get the same behavior as the Hyperlink widget - e.g.: If
> > > you click it, it'll call History.newItem(), but a user is also able to
> > > do 'right-click, open link in new window'.
> >
> > > The two possibilities seem to be
> > > 1) put plain text into a column, and implement the selection model to
> > > trigger History.newItem. Unfortunately, if you do this, 'right click,
> > > open link in new window' does not work, as it is not a 'true'
> > > hyperlink
> > > 2) Put HTML into a column, using a <a> tag with a # URL.
> > > Unfortunately, this causes a page reload in IE, as per Issue #2152 in
> > > GWT's issue tracker.
> >
> > > Has anyone found a solution to this?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to
> [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.