module ProMotion::Table::Searchable

Public Instance Methods

dt_searchDisplayController(controller, shouldReloadTableForSearchString:search_string) click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 77
def dt_searchDisplayController(controller, shouldReloadTableForSearchString:search_string)
  @_data_table_search_string = search_string
  reset_search_frc
  true
end
dt_searchDisplayControllerWillBeginSearch(controller) click to toggle source

iOS methods, headless camel case #######

# File lib/project/pro_motion/data_table_searchable.rb, line 63
def dt_searchDisplayControllerWillBeginSearch(controller)
  @_data_table_searching = true
  search_controller.delegate.will_begin_search if search_controller.delegate.respond_to? "will_begin_search"
end
dt_searchDisplayControllerWillEndSearch(controller) click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 68
def dt_searchDisplayControllerWillEndSearch(controller)
  @_data_table_searching = false
  @_search_fetch_controller.delegate = nil unless @_search_fetch_controller.nil?
  @_search_fetch_controller = nil
  @_data_table_search_string = nil
  search_controller.delegate.will_end_search if search_controller.delegate.respond_to? "will_end_search"
  update_table_data
end
make_data_table_searchable(params={}) click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 5
def make_data_table_searchable(params={})
  if params[:search_bar][:fields].nil?
    raise "ERROR: You must specify fields:[:example] for your searchable DataTableScreen. It should be an array of fields you want searched in CDQ."
  else
    @data_table_predicate_fields = params[:search_bar][:fields]
  end
  params[:delegate] = search_delegate
  params[:search_results_updater] = search_delegate

  make_searchable(params)
end
reset_search_frc() click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 46
def reset_search_frc
  # Update the filter, in this case just blow away the FRC and let
  # lazy evaluation create another with the relevant search info
  @_search_fetch_controller.delegate = nil unless @_search_fetch_controller.nil?
  @_search_fetch_controller = nil
end
search_delegate() click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 53
def search_delegate
  @_search_delegate ||= begin
    d = DataTableSeachDelegate.new
    d.parent = WeakRef.new(self)
    d
  end
end
search_fetch_controller() click to toggle source
# File lib/project/pro_motion/data_table_searchable.rb, line 17
def search_fetch_controller
  @_search_fetch_controller ||= new_frc_with_search(search_string)
end