Hi,

wicketstuff's StatelessAjaxFallbackLink sets its own id as its markupId. I'm not sure why it is doing that (perhaps to prevent a session?), but now all your links use the identical markupId "link", and all Ajax behaviors bind to the first anchor tag:

- clicking on the first link triggers all three ajax events simultaneously

- while clicking on the second or third link triggers the fallback for the corresponding link

Note that wicketstuff-stateless has been deprecated in 7.x and removed in 8.x, since Wicket now already comes with similar classes.

As a workaround you can alter the markup id by yourself:

                StatelessAjaxFallbackLink link = new StatelessAjaxFallbackLink("link") {
                    @Override
                    protected void onInitialize() {
                        super.onInitialize();

                        setMarkupId(getPageRelativePath());
                    }

I'd recommend switching to Wicket 7.x or 8.x, as 6.x will no longer get updates.

Have fun
Sven


Am 27.05.2018 um 04:47 schrieb trlt:
I have a very simple program: list of links which prints a message when the
selected link is clicked. It works fine when I use AjaxLink or
StatelessLink, but I am having issues when I changed it to
StatelessAjaxFallbackLink (from wicketstuff-stateless package).  Instead of
printing that's selected, it prints the list of all the links when the FIRST
link is selected.  It works as expected for other links:

ListView links = new ListView("links", LIST) {

                        @Override
                        protected void populateItem(final ListItem item) {
                                final Label linkLabel = new Label("linkLabel", 
new
Model(item.getDefaultModelObjectAsString()));

                        
                                StatelessAjaxFallbackLink link = new 
StatelessAjaxFallbackLink("link") {

                                        @Override
                                        public void onClick(AjaxRequestTarget 
target) {
                                                System.out.println("selected: " 
+
linkLabel.getDefaultModelObjectAsString());
                                        }
                                };
                                item.add(link.add(linkLabel));
                        }
                };
                add(links);



myproject.gz
<http://apache-wicket.1842946.n4.nabble.com/file/t374889/myproject.gz>

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



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

Reply via email to