You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Seven Corners <sh...@blackwave.tv> on 2009/03/26 17:24:03 UTC

Link not getting onclick event

I have link that is not receiving an onclick event.  It links to a page in my
application, and I do not want it bookmarkable.  It's in a RefreshingView. 
The browser renders the link with the correct style for a link, but if you
hover over the link, you don't get the URL to show up in the status bar.  So
something is very whacked.

The HTML looks like this:

...
              <table>
                  <tr wicket:id="snmpSubscription">
                    <td wicket:id="trapIdCell">  </td>
                ...


and the code is like this:

    private class SNMPTrapEventSubscriptionView extends
            RefreshingView<SNMPTrapEventSubscriptionBean>
    {
        ...
        @Override
        protected void populateItem( Item<SNMPTrapEventSubscriptionBean>
item )
        {
            final SNMPTrapEventSubscriptionBean bean =
item.getModelObject();

            WebMarkupContainer cell = new WebMarkupContainer( "trapIdCell"
);
            Link snmpLink = new Link( "snmpLink" )
            {
                private static final long serialVersionUID = 1L;

                @Override
                public void onClick()
                {
--> we never get    try 
    here            {
                        PageParameters params = new PageParameters();
                        params.add( SettingsPage.kbMANAGE_SNMP,
Boolean.toString( true ) );  
                        params.add( SettingsPage.kiSUBSCRIPTION_ID,
Integer.toString( bean.getId() ) );
                        
                        EventSubscriptionsPanel.this.setResponsePage(
SettingsPage.class, params );
                    }   
                    catch( Throwable t )
                    {
                        logger.error( t.getMessage(), t );
                    }
                }
            };
            snmpLink.add( new Label( "id" ) );
            cell.add( snmpLink );
            item.add( cell );
            ...

Place a breakpoint in the onClick() handler and we never get there.  In the
browser, the anchor text shows up blue, indicating that the browser knows
it's a link, but you click on it and nothing happens.  In the HTML output,
this is the link's href:

href="?wicket:interface=:4:rightHandContentPanel:tabs:panel:tableWrapper:snmpSubscription:3:trapIdCell:snmpLink::ILinkListener::"

It doesn't look like the href has the right class but I don't know.

The model is a CompoundPropertyModel of my SNMPTrapEventSubscriptionBean
bean; I had a provider that's a
LoadableDetachableModel<List<SNMPTrapEventSubscriptionBean>>, and I load a
list of data from the server.  I am getting accurate data; it's the link
that isn't working.

Anyone have a clue what I'm doing wrong?

Thanks in advance.

 
-- 
View this message in context: http://www.nabble.com/Link-not-getting-onclick-event-tp22725492p22725492.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: Link not getting onclick event

Posted by Seven Corners <sh...@blackwave.tv>.
Thanks for getting back to me.  I figured it out; I had a mismatched div tag
that Firefox forgave.  It wasn't a Wicket issue at all.
-- 
View this message in context: http://www.nabble.com/Link-not-getting-onclick-event-tp22725492p22781576.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: Link not getting onclick event

Posted by Martijn Dashorst <ma...@gmail.com>.
Impossible to debug without *all* your markup from your listitem. You
left the link markup out!

Martijn

On Thu, Mar 26, 2009 at 6:24 PM, Seven Corners <sh...@blackwave.tv> wrote:
>
> I have link that is not receiving an onclick event.  It links to a page in my
> application, and I do not want it bookmarkable.  It's in a RefreshingView.
> The browser renders the link with the correct style for a link, but if you
> hover over the link, you don't get the URL to show up in the status bar.  So
> something is very whacked.
>
> The HTML looks like this:
>
> ...
>              <table>
>                  <tr wicket:id="snmpSubscription">
>                    <td wicket:id="trapIdCell">  </td>
>                ...
>
>
> and the code is like this:
>
>    private class SNMPTrapEventSubscriptionView extends
>            RefreshingView<SNMPTrapEventSubscriptionBean>
>    {
>        ...
>        @Override
>        protected void populateItem( Item<SNMPTrapEventSubscriptionBean>
> item )
>        {
>            final SNMPTrapEventSubscriptionBean bean =
> item.getModelObject();
>
>            WebMarkupContainer cell = new WebMarkupContainer( "trapIdCell"
> );
>            Link snmpLink = new Link( "snmpLink" )
>            {
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                public void onClick()
>                {
> --> we never get    try
>    here            {
>                        PageParameters params = new PageParameters();
>                        params.add( SettingsPage.kbMANAGE_SNMP,
> Boolean.toString( true ) );
>                        params.add( SettingsPage.kiSUBSCRIPTION_ID,
> Integer.toString( bean.getId() ) );
>
>                        EventSubscriptionsPanel.this.setResponsePage(
> SettingsPage.class, params );
>                    }
>                    catch( Throwable t )
>                    {
>                        logger.error( t.getMessage(), t );
>                    }
>                }
>            };
>            snmpLink.add( new Label( "id" ) );
>            cell.add( snmpLink );
>            item.add( cell );
>            ...
>
> Place a breakpoint in the onClick() handler and we never get there.  In the
> browser, the anchor text shows up blue, indicating that the browser knows
> it's a link, but you click on it and nothing happens.  In the HTML output,
> this is the link's href:
>
> href="?wicket:interface=:4:rightHandContentPanel:tabs:panel:tableWrapper:snmpSubscription:3:trapIdCell:snmpLink::ILinkListener::"
>
> It doesn't look like the href has the right class but I don't know.
>
> The model is a CompoundPropertyModel of my SNMPTrapEventSubscriptionBean
> bean; I had a provider that's a
> LoadableDetachableModel<List<SNMPTrapEventSubscriptionBean>>, and I load a
> list of data from the server.  I am getting accurate data; it's the link
> that isn't working.
>
> Anyone have a clue what I'm doing wrong?
>
> Thanks in advance.
>
>
> --
> View this message in context: http://www.nabble.com/Link-not-getting-onclick-event-tp22725492p22725492.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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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