I can’t seem to make the pagination work. The link_to_remote defined in
the helper is pointing to the wrong url.
I have set up things like so:
defined a search method in de project_controller located in
apps/admin/project. In de tutorial the method is called list. defined in
the item_controller
I copy and paste the helper methodes to project_helper in the folder
helpers/admin/project_helper
The files that create the view are located in views/admin/project
#method used in search form results
def sort_td_class_helper(param)
result = ‘class=“sortup”’ if @params[:sort] == param
result = ‘class=“sortdown”’ if @params[:sort] == param + “_reverse”
return result
end
#method used in search form
def pagination_links_remote(paginator)
page_options = {:window_size => 2}
pagination_links_each(paginator, page_options) do |n|
options = {
:url => {:action => ‘search’, :params => @params.merge({:page =>
n})},
:update => ‘search_table’,
:before => “Element.show(‘spinner’)”,
:success => “Element.hide(‘spinner’)”
}
html_options = {:href => url_for(:action => ‘search’, :params => @params.merge({:page => n}))}
link_to_remote(n.to_s, options, html_options)
end
end