1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
    izak18 is on a distinguished road

      0  

    Default Unanswered: Remove Record and the Add Record doesn't work

    Unanswered: Remove Record and the Add Record doesn't work


    Hi guys, I'm here again with a problem, I don't know what could be wrong.
    I have a record saved, then I want to remove that record and add a new one but only "remove" it works, adding the new record doesn't, this is the code:

    Code:
    var inter1 = Ext.ModelMgr.create({id: 1, Funcion: 'AG', PedidoId: currentDoc, Codigo: Codigo},'interlocutoresModel');
    
    var currentInter = interStore.getAt(0);
    if(!currentInter){
        interStore.add(inter1);
        interStore.sync();
        console.log("Add");
    }
    else{
        if (interStore.findRecord('id', currentInter.data.id)) {
            interStore.remove(currentInter);
            interStore.sync();
            console.log("Remove");
        }
        interStore.add(inter1);
        console.log("Update");
        interStore.sync();
    }
    Hope you can help me.
    Thanks a lot.

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    104
    Answers
    4
    Vote Rating
    0
    izak18 is on a distinguished road

      0  

    Default


    Forget it, I found how to do it in this post:

    http://www.sencha.com/forum/showthread.php?153432-1.1.1-broke-store.sync-for-modified-records/


    But still, I dont know why I can't remove and add a record like you can see in the code.
    Thanks anyway.

Tags for this Thread