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
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.
-
25
-
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); });