Re: set table disabled while ajax request is running
You can use AjaxChannel with the same name for all Ajax buttons/links in the table and with type ACTIVE. This way only one Ajax request for this channel will be executed. All other will be discarded. Martin Grigorov Wicket Training and Consulting On Thu, Jan 9, 2014 at 5:02 PM, wrote: > It is nice to show additional text oder something like this, but I cant > hide or disable the shown table. So the user has still the possibility to > click at one of the toolbars, which will throw an exception. > > Are there no other ways? > > > 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 > > T-SYSTEMS INTERNATIONAL GMBH > Aufsichtsrat: Thomas Dannenfeldt (Vorsitzender) > Geschäftsführung: Reinhard Clemens (Vorsitzender), Dr. Ferri Abolhassan, > Thilo Kusch, Dr. Markus Müller, Georg Pepping, Hagen Rickmann > Handelsregister: Amtsgericht Frankfurt am Main HRB 55933 > Sitz der Gesellschaft: Frankfurt am Main > WEEE-Reg.-Nr. DE50335567 > > -Ursprüngliche Nachricht- > Von: Andrew Geery [mailto:andrew.ge...@gmail.com] > Gesendet: Donnerstag, 9. Januar 2014 15:12 > An: users@wicket.apache.org > Betreff: Re: set table disabled while ajax request is running > > The easiest way to do that is to use > > http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/IAjaxIndicatorAware.html > > See > > http://wicketinaction.com/2008/12/preventing-double-ajax-requests-in-3-lines-of-code/ > for > an example. > > Andrew > > > On Thu, Jan 9, 2014 at 7:07 AM, Martin Grigorov >wrote: > > > 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, 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 > > > map, AjaxRequestTarget target) { > > > setEnabled(false); > > > } > > > @Override > > > public void onAfterRespond(Map > > > 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 > > > > > > > > > > > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: set table disabled while ajax request is running
The easiest way to do that is to use http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/ajax/IAjaxIndicatorAware.html See http://wicketinaction.com/2008/12/preventing-double-ajax-requests-in-3-lines-of-code/ for an example. Andrew On Thu, Jan 9, 2014 at 7:07 AM, Martin Grigorov wrote: > 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, 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 map, > > AjaxRequestTarget target) { > > setEnabled(false); > > } > > @Override > > public void onAfterRespond(Map 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 > > > > > > > > >
Re: set table disabled while ajax request is running
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, 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 map, > AjaxRequestTarget target) { > setEnabled(false); > } > @Override > public void onAfterRespond(Map 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 > > > >