-
Notifications
You must be signed in to change notification settings - Fork 147
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
Reorderable table screen cells #570
Conversation
Also checks for the method and warns the user.
Don't merge yet... going to make one more feature that allows the user to select if they want the cells to stay inside their own section or not. |
|
||
def tableView(tableView, moveRowAtIndexPath:from_index_path, toIndexPath:to_index_path) | ||
# TODO - Make this more readable | ||
self.promotion_table_data.section(to_index_path.section)[:cells].insert(to_index_path.row, self.promotion_table_data.section(from_index_path.section)[:cells].delete_at(from_index_path.row)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this bit here that actually manipulates the data should be moved to the table_data.rb
file. https://github.com/clearsightstudio/ProMotion/blob/master/lib/ProMotion/table/data/table_data.rb
We already have a delete_cell
method in there, so maybe we could call the new method move_cell
or something.
Added ability to pass |
👍 Looks good to me. |
I HATE this test. Always fails randomly on Travis. |
Reorderable table screen cells
Wiki? |
Pass
:moveable
in the cell hash astrue
and then put the table into editing mode by either callingtoggle_edit_mode
oredit_mode(enabled:true)
and you'll see the draggable handles.When you drop the cell, it will fire
on_cell_moved:
with arguments of a hash:this should be ready to go and has great test coverage.