Ups... I've made reply to author instead of reply.

Thank you all :)

A little change in Kevin's solution and we are done!

<%- @counter=0 -%>
<table-plus...>
  <prepend-field-heading-row:><th class="position-heading">#</th></
prepend-field-heading-row:>
  <prepend-tr:><td><%= @counter += 1 %></td></prepend-tr:>
</table-plus>

On Apr 15, 12:01 am, kevinpfromnm <[email protected]> wrote:
> I would probably do a prepend-tr: and add a column that way.  Adding a
> counter with erb then would be simplest way that I could see since it
> seems you're not doing any pagination with the collection.
> <%- counter = 0 -%>
> <table-plus ...>
>   <prepend-tr:><td><%= counter += 1 %></td></prepend-tr:>
> </table-plus>
>
> On Apr 14, 2:36 pm, Bryan Larsen <[email protected]> wrote:
>
> > If you're in a form, you can use form_field_path:
>
> >   <form>
> >     <table-plus with="&@stories" fields="title, this, tasks.count,
> > status">
> >           <title-view:>
> >             <%= form_field_path[-2] %>
> >           </title-view:>
> >     </table-plus>
> >   </form>
>
> > for the first row, form_field_path contains:  ['project', 'stories',
> > 0, 'title'].
>
> > This hack would let you use it outside a form.  If Tom doesn't think
> > it's gross, I can add it to edge hobo.
>
> > diff --git a/hobo/lib/hobo/dryml/template_environment.rb b/hobo/lib/
> > hobo/dryml/template_environment.rb
> > index adc065b..29e1928 100644
> > --- a/hobo/lib/hobo/dryml/template_environment.rb
> > +++ b/hobo/lib/hobo/dryml/template_environment.rb
> > @@ -287,6 +287,9 @@ module Hobo::Dryml
> >          if @_form_field_path
> >           �...@_form_field_path += path
> >           �...@_form_field_paths_by_object[@_this] = @_form_field_path
> > +        else
> > +         �...@_form_field_path = path
> > +         �...@_form_field_paths_by_object = {...@_this =>
> > @_form_field_path}
> >          end
>
> >          yield
>
> > On Apr 13, 7:54 pm, Tiago Franco <[email protected]> wrote:
>
> > > Hi,
>
> > > I'm currently displaying memberships in a table-plus, like:
>
> > >  <table-plus:memberships fields="user, team, score, notes">
> > > ...
>
> > > I would like to have a column with the row number, a simple counter
> > > from 1 to memberships.size().
>
> > > Is there a straightforward way to do it? I though in creating a method
> > > in the membership to provide its position in the collection, but this
> > > seems like a dumb hack.
>
> > > Thanks,
> > >   TF
--~--~---------~--~----~------------~-------~--~----~
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