Hi, I would like to delete differents models from collections and restart from id 1 but it doesn't work. For instance i have some contacts (collection) and information's values for each one. I can delete a contact but the values no.
Here is my controller
function deleteContact(e) { if ($model) { var contact_id = $model.id; } var contact = contacts.get(contact_id); var fieldvalues = Alloy.Collections.fieldvalue.where({contact_id: contact_id}); var listvalues = Alloy.Collections.listvalue.where({contact_id: contact_id}); for (var key = 0; key < fieldvalues.length; key++) { if(fieldvalues) { fieldvalues[key].destroy(); } } for(var key = 0; key < listvalues.length; key++) { if(listvalues) { listvalues[key].destroy(); } } Alloy.Collections.fieldvalue.fetch(); Alloy.Collections.listvalue.fetch(); contact.destroy(); contacts.fetch(); }when i delete the contact and add a new one the last one take the previous one id that i want. I would like to do the same with values whiches are differents models containing contact_id.