Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-502] Setting both 'moving' & 'editing' on a tableView doesn't work

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:53:18.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.3.0
ComponentsiOS
Labelsbug, ios, iphone, tableview
ReporterJames Wragg
AssigneeJeff Haynie
Created2011-04-15T02:30:26.000+0000
Updated2011-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.

Comments

  1. Jeff Haynie 2011-04-15

    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?

  2. James Wragg 2011-04-15

    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.

  3. Blain Hamon 2011-04-15

    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))

  4. Jeff Haynie 2011-04-15

    (from [9de20f5445eff867b9d3ece18d32599443f97ee0]) Closes #502 http://github.com/appcelerator/titanium_mobile/commit/9de20f5445eff867b9d3ece18d32599443f97ee0"> http://github.com/appcelerator/titanium_mobile/commit/9de20f5445eff...

JSON Source