私はextjs4でこれを書いていました:
Ext.define('Superstore', {
extends: 'Ext.data.Store'
config : {
customer : null,
},
applyCustomer : function (value) {
this.customer = value;
},
model : 'Supermodel'
});
私はextjs6で同じことを試みましたが、成功しませんでした:'
Ext.define('Supermodel', {
extend: 'Ext.data.Model',
requires: ['Ext.data.reader.Json', 'Ext.data.proxy.Rest'],
config: {
customer: null
},
fields: [
{name: 'id', type: 'string'},
...
],
proxy: {
type: 'rest',
url: '/customers/{customer}/users',
reader: {
type: 'json'
}
},
applyCustomer: function (value) {
this.customer = value;
this.proxy.url.replace('{customer}', value);
}
});
彼らは魔法を取り除きましたか?または、私のコードのように私のURLを構築するための他のより良い方法はありますか? すでにいくつかのソリューションを見てきましたが、どれも私のアプリケーションに適合しませんでした。ログイン後にバックエンドから送信されるセッション経由で customerId を取得します。StoreManager 経由でストアを取得し、顧客レコードを取得してプロキシに適用します。
前もって感謝します。