Results 1 to 7 of 7

Thread: Grid and restful store: no delete requests

  1. #1

    Default Grid and restful store: no delete requests

    I have a grid. Want to delete items with REST proxy. Grid can read data from server, but doesn't any delete requests there. Everything, like in ExtJS4 examples
    Here is grid's store and proxy code inside grid code (in InitComponent() ):
    Code:
            this.store = Ext.create('Ext.data.Store', {
                autoSync: true,
    
    
    
    
                model:this.model,
    
    
                addCondition:function (key, value) {
                    this.proxy.extraParams[key] = value;
                    return this;
                },
                sorters:[
                    {
                        property:'NAME',
                        direction:'ASC'
                    }
                ],
                proxy:{
                    type:'rest',
                    extraParams:{
                        model:this.model
                    },
                    url:document.head.baseURI + 'rest',
    
    
                    reader:{type:'json',root:'data'},
                    writer:{type:'json',root:'data'}
    
    
                },
                initComponent:function(){
                    this.model.proxy = this.proxy;
                }
            });
    Store doesn't make any delete request at all. Firebug console is empty. And here is event, that calling removing method of store:
    Code:
    if (btn=='yes'){
             var selection = clientgrid.getView().getSelectionModel().getSelection()[0];
             clientgrid.store.remove(selection);
    }
    This action removes one record from local data, but after data refresh from server, this record is still there. What can help me?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    A store doesn't have an initComponent method as it's not a component.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    Quote Originally Posted by mitchellsimoens View Post
    A store doesn't have an initComponent method as it's not a component.
    Dragged initComponent code to another place. Same problem.

    I tried many options of this grid, tried ajax proxy, rest proxy, change urls, api, readers and writers and other. But there is no delete request at all.

    If i call store.save() there is a request to my link... But I need it on create, delete and update actions, not on save...

  4. #4
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    do you have the "idProperty" for the model ?

  5. #5

    Default

    idPropery doesn't help.

  6. #6
    Sencha User
    Join Date
    Nov 2008
    Posts
    3

    Default

    I encountered the same issue.
    selection.destroy() does the work.

  7. #7
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Answers
    13

    Default

    clientgrid.store.remove(selection);
    this wont trigger a delete to the server
    store requests are triggered after doing a .load() or a .sync()
    u need to remove the record from the store with store.remove(someRecord or records)
    this onlye marks them as deleted but i didnt tell the server to delete them yet

    then you have to do a store.sync() this will actually tell to the server which records are been created, which been modified, and which been deleted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •