I use Wicket 1.5.10 and I'm stuck at problem with DataView.
I have overview page which contains filter and some container with elements.

You can see simple example prepared by me:

Filter contains TextField and AjaxLink. 
*HTML:*
<p>
        <label>Search field</label>
        <input wicket:id="filteredField" type="text">
</p>
<p>
         Filter Link 
</p>

*JAVA*
TextField<String> filteredField = new TextField<String>("filteredField", new
PropertyModel<String>(HomePage.this, "searchLink"));
filteredField.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -4317299769705904431L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
        //do nothing
}
});
filteredField.setOutputMarkupId(true);
add(filteredField);             

add(new AjaxLink<Void>("filterLink") {
private static final long serialVersionUID = -1544074968276382557L;

@Override
public void onClick(AjaxRequestTarget target) {
target.add(dataViewContainer);
try {
        // use to demonstare the problem
        Thread.sleep(1000);
} catch (InterruptedException e) {
        e.printStackTrace();
}
}
});

Container with elements is DataView  where each element is Link.
*JAVA*:
private class MyDataView extends DataView<String> {
        private static final long serialVersionUID = -4473460467718688831L;

        protected MyDataView(String id) {
            super(id, new MyDataProvider());
        }

        @Override
        protected void populateItem(Item<String> item) {
                        Link<Void> link = new Link<Void>("elementLink") {

                                private static final long serialVersionUID = 
1582520788088815276L;

                                @Override
                                public void onClick() {
                                        
                                }
                                
                        };
                        link.add(new Label("label", item.getModelObject()));
                        item.add(link);
        }
        
    }

*HTML*:
<div wicket:id="dataViewContainer">
        <div wicket:id="dataView">
             
       </div>
</div>

If I click on "filterLink" and then immediately click on some link in
DataView, then Wicket throws exception:
<pre>
org.apache.wicket.request.handler.ComponentNotFoundException: Could not find
component 'dataViewContainer:dataView:5:elementLink' on page 'class
com.mycompany.HomePage
     at
org.apache.wicket.request.handler.PageAndComponentProvider.getComponent(PageAndComponentProvider.java:181)
     at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getComponent(ListenerInterfaceRequestHandler.java:92)
     at
org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:239)
     at
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
     at
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
     at
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
     at
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
     at
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
     at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
</pre>

We meet this problem very often when our customers do not wait for response
and click on a link in DataView.
What do I have to do in this case? What approach is the best here?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-with-dynamic-links-in-DataView-tp4668229.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to