0
votes

I am using Ext js rest proxy to perform crud option to a rest API. While syncing data between store and server, proxy is using client request url instead of rest URL defined in proxy while delete data from store.

Model Class :

Ext.define('RestroApp.model.Restro', {
    extend:'Ext.data.Model',
    alias:'model.restro',
    idProperty:'restroId',
    identifier: 'sequential',
    fields:[
        {name:'restroName', type:'string'},
        {name:'address', type:'string'},
        {name:'restroId', type:'string'},
        {name:'latitute', type:'int'},
        {name:'longitute', type:'int'},
        {name:'isVeg', type:'boolean'}
    ]
});

Store Class :

Ext.define('RestroApp.store.RestroStore', {
    extend:'Ext.data.Store',
    storeId:'restostore',
    alias:'store.restrostore',
    requires:['RestroApp.model.Restro'],
    model:'RestroApp.model.Restro',
    proxy:{
        type:'rest',
        api:{
            read:'http://localhost:12080/restro/list',
            create: 'http://localhost:12080/restro/add',
            update:'http://localhost:12080/restro/update',
            destory:'http://localhost:12080/restro/delete'          
        },
        reader:{
            type:'json'             
        },
        writer:{
            type:'json'
        }
    },  
    autoLoad:true   
});

And I am running my ext js on http://localhost:8007 while rest api on http://localhost:12080

ex. ViewController

Ext.define('RestroApp.view.main.RestroListController', {
    extend:'Ext.app.ViewController',
    alias:'controller.restrocontroller',
    requires:['RestroApp.model.Restro'],
    refreshData: function (){
        var store=Ext.getStore('restostore');
        store.removeAt(0);
        store.sync();       
    }
});

Like while deleting data from store it's gives an error DELETE localhost:8007/3?_dc=1494918882624 405 (Http method DELETE is not supported by this URL) and configured URL is localhost:12080/restro/delete

1

1 Answers

2
votes

You have a typo on the destroy api property - "destory".