私はExtJs4.1とDeftJsを使用しています。
一部のクラスは、次のようなコンストラクターで定義されます。
Ext.define( 'A.helper.Report', {
config: {
conf : null,
viewMain : null
},
constructor: function( oConfig ) {
this.conf = oConfig.conf;
this.viewMain = oConfig.viewMain;
this.initConfig( oConfig );
}
...
ここで、このクラスのいくつかのインスタンスを次のように作成します。
var class1 = Ext.create( 'A.helper.Report', {
conf: someValue,
viewMain: someObject
} );
var class2 = Ext.create( 'A.helper.Report', {
conf: otherValue,
viewMain: otherObject
} );
これらのインスタンスを使用する場合、異なるoConfig
データを提供しますが、両方ともclass1
2class2
番目のデータを持ちますoConfig
。
したがってthis.conf
、両方のインスタンスで呼び出すと、が取得されますsomeValue
。
作成済みのインスタンスのデータを保持するにはどうすればよいですか?
解決:
私が書いた
Ext.define( 'A.helper.Report', {
...
references: {}
...
そこに私のインスタンスを置き、古いインスタンスをオーバーライドします。
ヘルプに切り替えreferences: null
ました。
..。