0
私は、残りのAPIに対してcrudオプションを実行するためにExt js rest proxyを使用しています。 ストアとサーバー間でデータを同期している間、プロキシは、ストアからデータを削除するときに、プロキシで定義された残りのURLの代わりにクライアント要求urlを使用しています。Ext jsプロキシで定義されているREST API URLの代わりにリクエストURLを使用してプロキシを休止します。
モデルクラス:
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'}
]
});
ストアクラス:
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
});
元に、残りのAPIながらhttp://localhost:8007 に私のext JSを実行しています。 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();
}
});
ようですストアからデータを削除するエラー を与えながら、DELETEはlocalhost:3分の8007 _dc = 1494918882624 405(HTTPこのURLでサポートされていないDELETEメソッド) と構成URLはlocalhost:12080/restro/delete
ええ、ちょうどそのデバッグ中に見つけた、ありがとう:) – Ammi