lib/ProMotion/table/data/table_data.rb in ProMotion-2.6.1 vs lib/ProMotion/table/data/table_data.rb in ProMotion-2.7.0
- old
+ new
@@ -54,11 +54,11 @@
def default_search(cell, search_string)
cell[:searchable] != false && "#{cell[:title]}\n#{cell[:search_text]}".downcase.strip.include?(search_string.downcase.strip)
end
def search(search_string)
- start_searching(search_string)
+ start_searching(search_string) # update the search string
self.data.compact.each do |section|
new_section = {}
new_section[:cells] = section[:cells].map do |cell|
@@ -76,22 +76,20 @@
end
self.filtered_data
end
+ def start_searching(search_string = '')
+ self.filtered_data = []
+ self.filtered = true
+ self.search_string = search_string.downcase.strip
+ self.original_search_string = search_string
+ end
+
def stop_searching
self.filtered_data = []
self.filtered = false
self.search_string = false
self.original_search_string = false
- end
-
- private
-
- def start_searching(search_string)
- self.filtered_data = []
- self.filtered = true
- self.search_string = search_string.downcase.strip
- self.original_search_string = search_string
end
end
end