Titanium Community Questions & Answer Archive

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

I have an event listener for delete, How do I prevent the deletion of a tableViewRow?

var exists = db.execute("SELECT ID FROM DATAROWS WHERE ID = ?",e.row.id);
var flag = false;
if(exists.isValidRow()) {
flag = true;
if(flag == true) {
db.execute("DELETE FROM DATAROWS WHERE ID = ?",e.row.id);
/alert("Delete row " + e.row.id + ": " + rowLabels[e.row.id].text);/
return flag;

How can I make it so that when my flag == false, the row in question does not get deleted? (Deleted from the TableView, not the database) Better yet, how can I make the red circle with the white bar not even appear for a particular tableViewRow when the tableView is put in Edit Mode? Better yet, how can I make the last tableViewRow have an Insertion button instead of a Delete button, and trigger an insert event instead of a delete event?

Thanks in advance,

Not Tyler

— asked May 22nd 2010 by Tyler Queen
  • deletion
  • edit
  • insertion
  • tableview
  • tableviewrow

2 Answers

  • I need help on this aswell. I want to open a Options Dialog when delete is pressed on a tablerow.
    But pressing delete, deletes the Tablerow instantly.

    — answered January 24th 2011 by David P.
    1 Comment
    • David

      The original poster will have abandoned this post. Please raise your own question, properly describing your specific circumstances. Follow the Participating in the Q&A guide to increase your chances of getting an accurate answer quickly.

      — commented January 24th 2011 by Paul Dowsett
  • 25

    — answered June 19th 2012 by Bill Freedman
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.