1. #1
    Ext User
    Join Date
    Oct 2009
    Posts
    8
    Vote Rating
    0
    mmartinek is on a distinguished road

      0  

    Default RowEditor, remove showing up again?

    RowEditor, remove showing up again?


    I'm using a RowEditor with a Store and it seems like when I delete an item it just immediately shows up again.

    Here's my set up (Still learning ExtJS):
    Code:
    var store = new Ext.data.GroupingStore( {
                    url : 'AjaxProcessing/ProcessRequest.php',
                    writer : new Ext.data.JsonWriter( {
                        id : 'campaign_id',
                        writeAllFields : true,
                        successProperty : 'success'
                    }),
                    reader : new Ext.data.JsonReader( {
                        id : 'campaign_id', // used for phantom control
                        root : 'results',
                        totalProperty : 'total',
                        successProperty : 'success'
                    }, [ {
                        name : 'campaign_id',
                        type : 'int'
                    }, {
                        name : 'pretty_name',
                        type : 'string'
                    }, {
                        name : 'start_date',
                        type : 'date',
                        dateFormat : 'Y-m-d'
                    }, {
                        name : 'start_time'
                    }, {
                        name : 'stop_date',
                        type : 'date',
                        dateFormat : 'Y-m-d'
                    }, {
                        name : 'stop_time'
                    }, {
                        name : 'status',
                        type : 'string'
                    }, {
                        name : 'max_impressions',
                        type : 'int'
                    }, {
                        name : 'max_clicks',
                        type : 'int'
                    } ]),
                    sortInfo : {
                        field : 'campaign_id',
                        direction : "ASC"
                    }
    
                });
    In my GridPanel I had a tbar, with a remove item:
    Code:
    {
                                        ref : '../removeBtn',
                                        iconCls : 'icon-delete',
                                        text : 'Remove Campaign',
                                        disabled : true,
    
                                        handler : function() {
                                            grid.suspendEvents();
    
                                            editor.stopEditing();
                                            var s = grid.getSelectionModel()
                                                    .getSelections();
    
                                            for ( var i = 0, r; r = s[i]; i++) {
                                                store.remove(r);
    
                                            }
                                            store.commitChanges();
                                            grid.getView().refresh();
                                            grid.resumeEvents();
    
                                        }
                                    },
    It's a little messy with some extra things like commitChanges() and such.. I've been trying different methods, but they all seem to have the item show up again immediately.

    As for the log of what's going on: I go to the site and delete two records:


    Code:
    Array
    (
        [Category] => Campaign
        [Action] => List
        [xaction] => read
        [sessionID] => phpads4ae3d04357ac03.88626914
        [PHPSESSID] => lg2di4vn3hv9ieteivuhp0n3l1
    )
    
    -----------------------------
    
    Array
    (
        [results] => "1"
        [xaction] => destroy
        [sessionID] => phpads4ae3d04357ac03.88626914
        [PHPSESSID] => lg2di4vn3hv9ieteivuhp0n3l1
    )
    
    -----------------------------
    
    Array
    (
        [results] => "2"
        [xaction] => destroy
        [sessionID] => phpads4ae3d04357ac03.88626914
        [PHPSESSID] => lg2di4vn3hv9ieteivuhp0n3l1
    )
    
    -----------------------------
    Each deleted item is being taken off the list for about 100 milliseconds then added again in a different ordering. However, no read request is being issued again after the delete, so I'm not sure where it's loading the records from again. I would assume from the store, but how after the remove command is issued?

    Thanks!

    Also, I have looked around for a solution already. I have found a similar issue in another thread but the solution posted there doesn't apply (version upgrade). I'm using 3.0.0 and that matter was with 2.3. The destroy requests get a response of: {success:true}
    Last edited by mmartinek; 27 Oct 2009 at 12:35 PM. Reason: Extra info

  2. #2
    Ext User
    Join Date
    Jan 2008
    Posts
    4
    Vote Rating
    0
    johnd2i is on a distinguished road

      0  

    Default Same problem

    Same problem


    I too am getting the same issue. After a destroy the record is reappearing in the grid.

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    4
    Vote Rating
    0
    johnd2i is on a distinguished road

      0  

    Default Problem solved

    Problem solved


    Looks like I wasn't sending back a response of success:true. Now I'm not getting the phantom record showing up.

  4. #4
    Ext User
    Join Date
    Jan 2008
    Posts
    4
    Vote Rating
    0
    johnd2i is on a distinguished road

      0  

    Default more insight

    more insight


    Adding some listeners, especially the exception listener to the store showed me what is going wrong. You may want to use Firebug but my guess is that your response on the CRUD is dropping into the exception listener. I was able to figure out the problem with firebug. Here is my code:

    this.store = new Ext.data.GroupingStore({
    id: 'sp_store',
    proxy: this.proxy,
    reader: this.reader,
    writer: this.writer,
    autoSave: false,
    sortInfo: {
    field: 'name',
    direction: 'ASC'
    },
    listeners: {
    scope: this,
    write: function(store, action, result, res, rs){
    Ext.Msg.show({
    title: 'write succeeded',
    msg: res.message,
    icon: Ext.MessageBox.INFO
    });
    },
    exception: function(proxy, type, action, options, res, arg){
    Ext.Msg.show({
    title: 'REMOTE EXCEPTION',
    msg: res.message,
    icon: Ext.MessageBox.ERROR
    });
    }

Thread Participants: 1