You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Ch...@t-systems.com on 2016/12/07 08:34:59 UTC

Updating Columns of datatable by Ajax

Hello

I want to create a datatable which contains 2 columns. The first column should represent a state (started/stopped) and the second one should contain a button which depends on the state of the first column (start button / stop button).

If the state is started the stop button should be rendered and if the state is stopped the start button should be rendered. The starting and stopping is an asynchronous process so it will need an unknown amount of time until the state change to started or stopped.

I want to click the rendered button to start the certain process to start or stop. After the unknown amount of time when the start or stop process successfully finished the state of that row should change automatically. How can I realize it with ajax? I have no idea how to start. I hope someone can help me.


Mit freundlichen Grüßen
Christoph Manig




Re: Updating Columns of datatable by Ajax

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Please take a look at
http://wicketinaction.com/2014/07/working-with-background-jobs/

P.S. Use users@ mailing list for such kind of questions. @dev is about
dicussing development of Wicket itself. Thanks!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Dec 7, 2016 at 9:52 AM, Sven Meier <sv...@meiers.net> wrote:

> Hi Christoph,
>
> polling with an *AjaxTimerBehavior is the easiest solution:
> As long as a row shows a started state, it triggers an update via Ajax
> every second.
>
> Web sockets (https://ci.apache.org/projects/wicket/guide/7.x/guide/
> nativewebsockets.html) are an alternative.
>
> Have fun
> Sven
>
>
>
> On 07.12.2016 09:34, Christoph.Manig@t-systems.com wrote:
>
>> Hello
>>
>> I want to create a datatable which contains 2 columns. The first column
>> should represent a state (started/stopped) and the second one should
>> contain a button which depends on the state of the first column (start
>> button / stop button).
>>
>> If the state is started the stop button should be rendered and if the
>> state is stopped the start button should be rendered. The starting and
>> stopping is an asynchronous process so it will need an unknown amount of
>> time until the state change to started or stopped.
>>
>> I want to click the rendered button to start the certain process to start
>> or stop. After the unknown amount of time when the start or stop process
>> successfully finished the state of that row should change automatically.
>> How can I realize it with ajax? I have no idea how to start. I hope someone
>> can help me.
>>
>>
>> Mit freundlichen Grüßen
>> Christoph Manig
>>
>>
>>
>>
>>
>

Re: Updating Columns of datatable by Ajax

Posted by Sven Meier <sv...@meiers.net>.
Hi Christoph,

polling with an *AjaxTimerBehavior is the easiest solution:
As long as a row shows a started state, it triggers an update via Ajax 
every second.

Web sockets 
(https://ci.apache.org/projects/wicket/guide/7.x/guide/nativewebsockets.html) 
are an alternative.

Have fun
Sven


On 07.12.2016 09:34, Christoph.Manig@t-systems.com wrote:
> Hello
>
> I want to create a datatable which contains 2 columns. The first column should represent a state (started/stopped) and the second one should contain a button which depends on the state of the first column (start button / stop button).
>
> If the state is started the stop button should be rendered and if the state is stopped the start button should be rendered. The starting and stopping is an asynchronous process so it will need an unknown amount of time until the state change to started or stopped.
>
> I want to click the rendered button to start the certain process to start or stop. After the unknown amount of time when the start or stop process successfully finished the state of that row should change automatically. How can I realize it with ajax? I have no idea how to start. I hope someone can help me.
>
>
> Mit freundlichen Gren
> Christoph Manig
>
>
>
>