On Jul 27, 2011, at 11:44 AM, Bob Sleys wrote:
> I just setup the following table_plus. There are 152 records displayed in 1
> long table. I thought pagination was pretty much automatic with table_plus
> but I'm not getting any pagination at all.
>
> In my Floors Controller. I'm using table plus to display the collection of
> spaces on the floor model
>
> def show
> @floor = find_instance
> @spacelist = @floor.spaces.where(["name like ?",
> "%#{params[:search]}%"]).order(parse_sort_param(:name, :space_dwgid).join("
> "))
> end
>
> and in my floor/show.dryml
>
> <collection: replace>
> <table-plus with="&@spacelist" fields="this, space_dwgid, locations" >
> <empty-message:>No spaces match your criteria</empty-message:>
> </table-plus>
> </collection:>
>
> What am I missing to turn pagination on?
Table-plus just *shows* pagination nav if you pass it a paginated collection -
it doesn't do any of the actual finding.
You should be able to append the paginate call to the end of the chain in the
controller.
Also, I'd second Kevin's recommendation - I've run into this pattern a number
of times in my apps, where a "parent" model is very thin (a couple fields at
most) but the children are far more important. In that case, I'll typically
change places that link to the parent model to instead point to an
auto_actions_for-style action (/floors/:floor_id/spaces rather than
/floors/:floor_id). You can still show the relevant floor attributes and edit
link up at the top of the page, and things like pagination are much more
logical (and work out-of-the-box, as will things like 'New space' links).
--Matt Jones
--
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.