A couple of questions about pagination:
1. I have a view where I display Customer Information and then underneath
it display the products they have purchased in a Table-Plus.
The display works fine except that I do not get any pagination. All records
are displayed for a customer. This isn't a big deal for customers with only
a few records, but when I have some over 100 (I actually have some over
1000) it really doesn't work.
I have the following in my Products Controller:
class ProductsController < ApplicationController
hobo_model_controller
auto_actions :all
def index
hobo_index Product.apply_scopes(:search => [params[:search],:name,
:date_ordered, :date_received],
:joins=> :customer, :order_by => parse_sort_param(:date_invoiced,
:name, :customer, :vendor),
:paginate => true, :per_page => 20)
end
end
Any ideas?
2. On a view for a list of customers by themselves pagination works fine,
except that at the bottom of the screen I get this:
« Prev *1* 2 <http://localhost:3000/customers?page=2>
3<http://localhost:3000/customers?page=3>
4 <http://localhost:3000/customers?page=4>
5<http://localhost:3000/customers?page=5>
… 11 <http://localhost:3000/customers?page=11>
12<http://localhost:3000/customers?page=12> Next
» <http://localhost:3000/customers?page=2>
« Prev *1* 2 <http://localhost:3000/customers?page=2>
3<http://localhost:3000/customers?page=3>
4 <http://localhost:3000/customers?page=4>
5<http://localhost:3000/customers?page=5>
… 11 <http://localhost:3000/customers?page=11>
12<http://localhost:3000/customers?page=12> Next
» <http://localhost:3000/customers?page=2>
The pagination links are repeated twice.
Any ideas on that one?
3. While this isn't strictly related to pagination it is about the
controller pasted above....
I would like the resulting table-plus view to be sorted in date_invoiced
(descending) order. When I try to replace:
parse_sort_param(:date_invoiced, :name, :customer, :vendor),
with
parse_sort_param(:date_invoiced DESC, :name, :customer, :vendor),
I get errors.
Is there a different way to do that?
Thanks,
Jim
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/jbJUKRUmmr4J.
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.