Hope this helps, here is an example from my working code, from my
Custodians class, which has both search and sort working.
I think your issue is in the controller. Applying to your situation,
I'd say (1) you need to add hobo_index and pass it @timesheets; and
(2) @timesheet is extraneous and doesn't really make sense on an index
page (since you're not working with a particular timesheet).
Here's mine (plus Special Added Bonus of an export-to-excel example).
class CustodiansController < ApplicationController
hobo_model_controller
auto_actions :all
def index
@custodians = Custodian.apply_scopes(:search => [params
[:search], :name], :order_by => parse_sort_param
(:name, :custodian_type, :last_name, :group, :location, :total_volume,
:file_sets))
hobo_index @custodians
end
index_action :export
def export
@records = Custodian.all
if @records.count.zero?
flash[:notice] = "No #{self.model.name.pluralize} to export!"
elsif [email protected]_to?(:to_csv)
flash[:notice] = "Export not supported for #
{self.model.name.pluralize}"
else
send_data @records.to_csv, :type => 'text/csv', :filename =>
self.model.name.pluralize + '.csv'
end
end
end
for completeness, here's my index.dryml. Only material difference
between mine and yours is that I've used the implicit scope rather
than specifying it using with=.
<index-page>
<after-top-page-nav:>
<div class="export-link">%>
<a href="/custodians/export">Export</a>
</div>
</after-top-page-nav:>
<collection: replace>
<table-plus fields="this, custodian_type, last_name, group,
location, total_volume, file_sets.count">
<empty-message:>No custodians have been created.</empty-
message:>
<file_sets_count-heading-link:>File Sets</file_sets_count-
heading-link:>
<file_sets_count-view: class="numeric-field"><%=
number_with_delimiter(this) %></file_sets_count-view:>
<count-view: class="numeric-field"><%= number_with_delimiter
(this) %></count-view:>
<total_volume-view: class="numeric-field"><%=
number_to_human_size(this) %></total_volume-view:>
</table-plus>
</collection:>
</index-page>
On Jun 23, 2:42 pm, hobo_hippy <[email protected]> wrote:
> anyone? please?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---