[TIMOB-502] Setting both 'moving' & 'editing' on a tableView doesn't work
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:53:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.3.0 |
Components | iOS |
Labels | bug, ios, iphone, tableview |
Reporter | James Wragg |
Assignee | Jeff Haynie |
Created | 2011-04-15T02:30:26.000+0000 |
Updated | 2011-04-17T01:53:18.000+0000 |
Description
When setting both 'editing' & 'moving' to true on a tableView, only the first instruction is taken.
edit.addEventListener('click', function(){
win.setRightNavButton(cancel);
tableView.moving = true;
tableView.editing = true;
});
When edit is clicked the tableView will only go into moving mode, not edit too.
Yeah, we made them multi-exclusive on purpose. not sure that's the right thing. can you explain your use case so we can better understand how to make it work in this case?
Thanks for the prompt response Jeff. I have seen the re-order & delete actions combined as a single edit mode in many apps (e.g. edit your bookmarks in Safari) & wish to recreate simply due to lack of screen real estate.
Notes to self:
Okay, taking a deep look at this, and part of the problem is that the iPhone OS considers moving and editing to be one and the same. So on setting movable or editable, the iPhone UITableView queries things before there's time for the other to be set.
Currently, Ti.UI.TableView has 3 properties: editable, editing, and moving
Ti.UI.TableViewRow has 4: editable, indentOnEdit, movable, indentationLevel.
So to make this work, you need some way to express intent to move and to edit before going to moving/editing.
On a table currently, editable allows for editing (Swipe to delete) when not in edit mode. Entering edit mode with delete only is by editing, and entering edit mode with movement only is moving.
For a table row, indentationLevel and indentOnEdit don't play much of a part.
So, noting that booleans can be true, false, or undefined/null (which is neither true nor false):
A row will be movable if
1. ((row.movable==true) AND (table.editing == true)) OR
2. ((row.movable!=false) AND (table.moving == true))
A row will be always editable (swipe-to-deletable) if
1. (row.editable==true) OR
2. ((row.editable!=false) AND (table.editable==true))
A row will be editable during editing if
1. (row.editable==true) OR
2. ((row.editable!=false) AND (table.editable==true)) OR
3. ((row.editable!=false) AND (table.editing==true))
(from [9de20f5445eff867b9d3ece18d32599443f97ee0]) Closes #502 http://github.com/appcelerator/titanium_mobile/commit/9de20f5445eff867b9d3ece18d32599443f97ee0"> http://github.com/appcelerator/titanium_mobile/commit/9de20f5445eff...