Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Disable Delete icon in TableView edit mode?

I'm constructing a TableView with custom rows. I want the users to be able to switch to the Edit mode, which they can select multiple items, then hit "Complete" to mark these items as completed.

The problem is as soon as I set

tableView.editing = true

the red (-) would appear, but I don't want the user to remove the rows. But there seems to be nowhere in the API to disable this default behavior.

My alternative approach is to re-render the row when user clicks on the "Edit" button and customize the row accordingly.

So my question is whether it's possible to turn off the Delete icon in the edit mode.

— asked September 19th 2010 by Alex Le
  • mobile
  • tableview
  • tableviewrow
0 Comments

4 Answers

  • Check here: http://developer.appcelerator.com/question/54461/exclude-rows-from-editablemoving

    — answered September 19th 2010 by B Ben
    permalink
    0 Comments
  • Glad to see others are having my same issue (I'm the one that asked & answered the question Ben referred to)……this really should be documented.

    To prevent deleting a row: set editable = false for the row.

    — answered September 20th 2010 by Mike Robinson
    permalink
    0 Comments
  • Thanks for answering my question. I should have been a bit clearer in the original question. I actually want to have the editing animation to occur when you set the editing=true property of the tableView (the right-shifting animation for the rows which the hasChild icons disappearing and the red icons appearing). But in my case, I don't want to have the red icon to appear. However, Setting editable=false for the row means that it won't go into the edit mode at all, so no animation would occur.

    If you have RememberTheMilk app, click the "Edit" button in the tasks list will switch to the selection mode which you can select the tasks then hit the "Complete" button to complete them. This is what I wanted to mimic. If the red delete button can somehow be removed, then it's pretty simple to do something like that in Titanium.

    I tried to hack it around by looping thru my custom rows, and for each row, applied a translation transition to every child elements to mimic the shifting. The result wasn't too good because the animation was chugging and stopped at various random unfinished states. I also tried to apply the shifting transform to the row but the row itself doesn't seem to animate at all. Then I applied the transition transform to the tableView, but now the entire screen got shifted. So basically I just gave up on the animation, and just used a quick image toggle instead.

    — answered September 20th 2010 by Alex Le
    permalink
    1 Comment
    • Can you share your workaround, i basically want the delete button to do something else than delete a row.

      — commented February 5th 2013 by Hasnaad Din
  • Just wondering if anyone ever figured this out? I also would like to use the edit mode to select multiple rows and then run a function based on those selected rows. But I can't seem to figure out if its possible.

    — answered November 26th 2010 by Dave F
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.