Hi, You may show a veil above the table to prevent clicking on elements during the ajax call
Martin Grigorov Wicket Training and Consulting On Thu, Jan 9, 2014 at 1:01 PM, <christoph.ma...@t-systems.com> wrote: > Hello, > > in my application I have a table with some custom toolbars. This table > shows some data from the database if the user clicks an ajax button. But if > the user clicks the button again, the table will be replaced by a new table > with the new data. Here an example: > > target.add(page.get("table").replaceWith(getNewTable(newData))); > > This works fine. :) > > Now the problem. When the user clicks the ajax button again the ajax > request begins running, but the user is able to click one of toolbars of > the shown table. So I get an exception: the table.toolbar was not found. > This is ok because of the replacement with a new table. I want to disable > the shown table while the ajax request is running. If the request detaches > the old table will be replaced by the new table with enabled toolbars. > > I tried to override the onEvent-method of my table. Here you can see the > code: > @Override > public void onEvent(IEvent<?> event){ > if(event.getPayload() instanceof AjaxRequestTarget){ > AjaxRequestTarget actualRequestTaget = > (AjaxRequestTarget)event.getPayload(); > actualRequestTaget.addListener(new > AjaxRequestTarget.AbstractListener(){ > @Override > public void onBeforeRespond(Map<String,Component> map, > AjaxRequestTarget target) { > setEnabled(false); > } > @Override > public void onAfterRespond(Map<String,Component> map, > AjaxRequestTarget.IJavaScriptResponse response) { > setEnabled(true); > } > }); > } > } > > But this didn't work. I can click the toolbars while the request is > running and then I get the old excetion. The table will be disabled if the > request has finished. > > Is there any possibility to realize it? > > > > Mit freundlichen Grüßen > Christoph Manig > Systems Engineer > > T-Systems International GmbH > Systems Integration - SC Travel, Transport & Logistics > Hoyerswerdaer Str. 18 > 01099 Dresden > tel.: +49 (0) 351 / 8152 - 188 > fax: +49 (0) 351 / 8152 - 209 > email: christoph.ma...@t-systems.com > > > >