thanks for the tip! - here's what the eventual code looks like.

<repeat with="&fields.split(',')">
      <td style="text-align:center; font-weight: bold;">
          <%= "$#{total_price}" if this.gsub(/,/,'').strip ==
'total_price' %>
      </td>
</repeat>

Notice the total_price, summed by the table.  Rather than summing the
entire database, which wouldn't take in to account filters/pagination,
could take a long time, and would probably be better off in
controller...
<prepend-tr:>
      <% logger.warn "This: #{this.inspect}"
            total_price = total_price + this.total_price  %>
      <hidden-id-field/>
</prepend-tr:>

I suppose I should put the with fields thing on to the lighthouse..?

Cheers & Thanks,
--Peter

On Nov 12, 6:55 pm, kevinpfromnm <[email protected]> wrote:
> So far in my poking around I'm not seeing anyway of using with-
> fields.  Might be broken, but, since you're looking for some sort of
> custom code possibly for each, column, possibly just the same pattern,
> why not do:
>
> <tr>
>   <repeat with="&fields"><td><%= ModelName.sum(this) if
> ModelName.attr_type(this) != String %></td></repeat>
> </tr>
>
> since you appear to already have the fields in a variable.  Still, it
> is a little ugly as I couldn't think of a clean way to check if a
> given field is numeric.
>
> On Nov 11, 11:05 pm, Peter Ehrlich <[email protected]> wrote:
>
>
>
>
>
>
>
> > Trying to extend a table here.  (summing contents of a column, in case
> > there are any shortcuts I don't know of.)
>
> > <collection: replace>
> >     <table field="items" fields="&fields">
> >       <tfoot:>
> >         <tr>
> >           <with-fields>
> >           I'm a footer
> >           </with-fields>
> >         </tr>
> >       </tfoot:>
> >     </table>
> >   </collection:>
>
> > Error: undefined method `attr_order' for Array:Class for the with
> > fields opening tag line.
>
> > If I scrap the with-fields (used to get the right number of columns)
> > the error goes away.  question mark?
>
> > --Peter

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to