hi, I would like to delete a specific row the object is undefined, how can I do that?
if (json.response.posts[i].caption === '' || json.response.posts[i].caption === undefined) { delete(row); ? remove(row); ? }
2 Answers
Hi , do you want to delete a specific row of Table then
TableView.deleteRow(4)//Pass the index of the specific row to delete , like here I pass 5 as example.you can also refer http://developer.appcelerator.com/apidoc/mobile/1.8.2/Titanium.UI.TableView.deleteRow-method.html
Hi julien, Referring your sample code, and try this to remove
if (json.response.posts[i].caption === ' ' || json.response.posts[i].caption === undefined) { delete json.response.posts[i].caption }this code will remove the caption object if it is blank or undefined
or you can also try this code if caption if not an object or delete function does not work as per your need.
if (json.response.posts[i].caption === ' ' || json.response.posts[i].caption === undefined) { json.response.posts.splice(i,1); }After adding rows to table you should call tableView.deleteRow(row index to be deleted), above two solutions are for before adding data to table.
Your Answer
Think you can help? Login to answer this question!