You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by lawrence <sa...@gmail.com> on 2013/01/21 05:22:22 UTC

Dynamic Calculation on Table

Hi,

I am new to wicket. I want do a simple calculation on wicket table. On the
image you can find Cost, no of pax and no of days and total columns. I would
like to dynamically(when number is entered in textbox) calculate cost * no
of pax * no of days and put the total in total's column and sum all the
total into grand total. I am really confused how to do this.

<http://apache-wicket.1842946.n4.nabble.com/file/n4655557/calculation.png> 

Thank you




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Dynamic-Calculation-on-Table-tp4655557.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: Dynamic Calculation on Table

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

You can use JavaScript to make the calculations. Attach event listener to
the input fields (or their parent if you know how to use event delegation)
and when they change just update the value of the total field.

You can also use AjaxFormComponentUpdatingBehavior to do this with Wicket.
But this will do Ajax call to the server side, so it will be sub-optimal.

P.S. Please use users@wicket.apache.org for your questions.


On Mon, Jan 21, 2013 at 6:22 AM, lawrence <sa...@gmail.com> wrote:

> Hi,
>
> I am new to wicket. I want do a simple calculation on wicket table. On the
> image you can find Cost, no of pax and no of days and total columns. I
> would
> like to dynamically(when number is entered in textbox) calculate cost * no
> of pax * no of days and put the total in total's column and sum all the
> total into grand total. I am really confused how to do this.
>
> <http://apache-wicket.1842946.n4.nabble.com/file/n4655557/calculation.png>
>
> Thank you
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-Calculation-on-Table-tp4655557.html
> Sent from the Forum for Wicket Core developers mailing list archive at
> Nabble.com.
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>