Titanium Community Questions & Answer Archive

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

How do I switch between a Edit & Done button???

I have an addEventListener for my editButton which when fired sets tableview.editing = true; Whats the best way to switch/create a Done button???

Thanks

var editButton = Titanium.UI.createButton({
    title:'Edit',
    style:Titanium.UI.iPhone.SystemButtonStyle.DONE
});
win.setLeftNavButton(editButton);
— asked November 26th 2010 by Alan Tucker
  • iphone
0 Comments

2 Answers

  • Accepted Answer

    Something like this might get you started

    editButton.addEventListener('click', function(e) {
        Titanium.API.info("--> " + e.source.title);
        if (e.source.title == "Edit") {
            // do edit stuff
            tableview.editing = true;
            e.source.title = "Done";
        } else {
            // switch out of edit mode stuff
            tableview.editing = false;
            e.source.title = "Edit";
        }
    });
    
    — answered November 26th 2010 by Aaron Saunders
    permalink
    0 Comments
  • Spot on, thanks very much.

    — answered November 26th 2010 by Alan Tucker
    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.