Titanium Community Questions & Answer Archive

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

Tableview Saving row position in database

Hi,

I'm trying to save the position of my tableview rows, when they are moved around, by modifying and saving their ids in a database. However, I'm having an issue accessing any specific rows' data. I figure this is probably a very common task in many applications. Is there a predefined way to do this?

Thanks

— asked November 10th 2010 by Connor Zwick
  • position
  • row
  • tableview
0 Comments

3 Answers

  • Yes, but that's deleting a row. What I need is something to save the position of the tableview rows if I drag them around.

    — answered November 10th 2010 by Connor Zwick
    permalink
    0 Comments
  • 25

    — answered June 19th 2012 by Bill Freedman
    permalink
    0 Comments
  • I got around this by storing my data directly in the row.

    Assuming when you create your rows, you've got some sort of an ID or an object that you pulled from your database…

    for (var i = 0; i < 10; i++) {
      var row = Ti.UI.createTableViewRow();
      row.tagID = i;
    }
    

    Now when events fire, you can read the tagID:

    table.addEventListener('delete', function(evt) {
       alert(evt.row.tagID);
    });
    
    — answered November 10th 2010 by Dawson Toth
    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.