wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tmaus <loum...@yahoo.com>
Subject Re: Link is disabled after Ajax request
Date Tue, 31 Jul 2012 11:18:48 GMT
I see all log statements. 
All methods are properly accessed. 

I tested it both ways: 
1. A static link => complete rerendering of the page
2. AjaxLink => partially rerendering of the page

In both occasions the outcome is the same. 

Initial call renders link properly
Successive call renders link as label 

The funny thing about it is, that my FB button properly switches between the
states:

public class MenuBarPanel extends Panel
...

public MenuBarPanel(String id,Page page, IModel model) {
        super(id);
        this.page = page;

        final Session session = page.getSession();

        setOutputMarkupId(true);


AjaxLink fbLink = new AjaxLink("fb") {
            public void onClick(AjaxRequestTarget target) {
                LOG.debug("button clicked");

               
getPage().getRequestCycle().scheduleRequestHandlerAfterCurrent(new
RedirectRequestHandler("http://www.facebook.com/login.php?api_key=" +
pcs.getFbApiKey() + "&v=1.0"));
            }
        };
        add(fbLink).setEnabled(session.getAttribute("user") == null);

String fbImage = null;
        if(session.getAttribute("user")!=null){
            fbImage = new StringBuilder("https://graph.facebook.com/")
                    .append( ((User)
page.getSession().getAttribute("user")).getFacebookId())
                    .append("/picture")
                    .toString();

        }else{
            fbImage = "http://www.lamptechs.com/svcimg/login.png";
        }
        fbLink.add(new StaticImage("image", new Model(fbImage)));

adminPageLink = new AdminLink("adminLink", model);
        adminPageLink.setOutputMarkupId(true);
        add(adminPageLink);

 private class AdminLink extends AjaxLink<HomeAdminPage>{
        private IModel model;

        public AdminLink(String id, IModel model) {
            super(id, model);
        }

        public void onClick(AjaxRequestTarget target) {
            setResponsePage(new HomeAdminPage());
        }
    }

On initial call, login button is rendered. On the successive call it
properly renders my picture.

The "AdminLink" however is merely "properly" rendered on the initial call. 

Im pretty sure it is a typical beginners bug but I did not find any answer
in any forum so far .. 

thanks for your help






--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Link-is-disabled-after-Ajax-request-tp4650870p4650893.html
Sent from the Users forum 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


Mime
View raw message