Displaying 3 results from an estimated 3 matches for "search_sd_ticket_count_result".
2008 Apr 26
0
moving pagination code to model
...troller code as below
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing the full find, just find the
record count
@search_sd_ticket_count_result =
ServiceDeskTicket.find_where(:all,:select=>''count(*) as count1'' ) do
|sd|
end
record_count=@search_sd_ticket_count_result[0].count1.to_i
# step 3: create a Paginator, the second variable has to be
the number of ALL i...
2008 May 19
0
changed to will_paginate
...work with
will_paginate
step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing the full find, just find the
record count
@search_sd_ticket_count_result =
ServiceDeskTicket.find_where(:all,:select=>''count(*) as count1'' ) do
|sd|
sd.number.downcase =~
"%"+@sd_ticket_number.downcase+"%" if !@sd_ticket_number.nil?
sd.service_desk_status_i...
2008 Mar 06
1
pagination for an object array
...sd_ui_hash[:name]
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing the full find, just find the
record count
@search_sd_ticket_count_result =
ServiceDeskTicket.find_where(:all,:select=>''count(*) as count1'' ) do
|sd|
sd.number.downcase =~
"%"+@sd_ticket_number.downcase+"%" if !@sd_ticket_number.nil?
sd.name== @sd_ticket_nam...