Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows access to search_string in searchable table views #813

Merged
merged 2 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/ProMotion/table/data/table_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ def filtered?
@filtered == true
end

def search_string
@search_string ||= nil
end

def search(search_string)
@filtered = true
@search_string = search_string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still provide the correct value? For some reason I thought this gets overwritten (or is not up-to-date) somewhere later on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets the instance var every time someone types a new character and that function is run. You're right that it gets manipulated later on, but since we can't access that anymore (not sure what happened to that capability) i just reimplemented it like the filtered? method.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some significant changes that had to happen in order to support searching on iOS 8+ so either some of that functionality got lost on accident or couldn't be supported.

self.filtered_data = []

self.data.compact.each do |section|
Expand Down
4 changes: 4 additions & 0 deletions lib/ProMotion/table/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def searching?
self.promotion_table_data.filtered?
end

def search_string
self.promotion_table_data.search_string
end

def update_table_view_data(data, args = {})
self.promotion_table_data.data = data
if args[:index_paths]
Expand Down