Re: [go-nuts] Re: totalling a column in a html template.

2016-08-26 Thread Asit Dhal
Hi, If you really need to calculate total, you should leave that completely to the view layer(client side java script). On Fri, Aug 26, 2016 at 8:55 AM, Simon Ritchie wrote: > If you follow the Model View Controller (MVC) model, you should do all of > the clever stuff in your controller and jus

[go-nuts] Re: totalling a column in a html template.

2016-08-26 Thread Aliaksandr Valialkin
Hi Carl, try quicktemplate instead of html/template. It supports arbitrary data transformations inside the template code, so the 'totals' row may be easily implemented without external code: Suppose you have the following row struct: type Row struct

[go-nuts] Re: totalling a column in a html template.

2016-08-26 Thread Carl Ranson
Ok, Thanks for the answers. I've gone down the route of adding totals to my data structure. cheers, CR. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to gol

[go-nuts] Re: totalling a column in a html template.

2016-08-25 Thread Simon Ritchie
If you follow the Model View Controller (MVC) model, you should do all of the clever stuff in your controller and just use the view to render the result. When you invoke the view, you pass a structure with it contains the data to display. The trick is to design your structure to contain all the

[go-nuts] Re: totalling a column in a html template.

2016-08-25 Thread Val
As you may have guesses, the html/package is not designed to perform such clever calculations. It handles only the html rendering logic. You have 2 pretty good fallbacks actually : either precalculate and feed values to the template (server-side), or use javascript (client-side). Cheers Val On