问题
This is how I delete a tableviewrow on a longclick event of a tableview (android) $.tableview.deleteRow(e.index); , but this just removes the row. How do I also remove the data on my tableviewrow which will in turn remove it from collection via model id, and model-view binding should automatically reflect this in tableview.Any Ideas?Thank You.
回答1:
you need to delete the model object from the collection which will then trigger the appropriate events to update the table.
So in your longpress event
$.tableview.deleteRow(e.index);
collection.models[e.index].destroy() // should delete model, use index to get model
// from the collection
collection.fetch(); // should force table to update
来源:https://stackoverflow.com/questions/17419483/titanium-delete-tableviewrow-model-view-binding-should-automatically-reflect-ta