リモート サーバーにあるデータ ソースからコンテンツを読み取る必要があります (何も変更するためのアクセス権がありません)。
コンテンツを取得するために何日も試しましたが、うまくいきません。
次に、xml ファイルであるこのデータ ソースをダウンロードし、コードと同じフォルダーに配置して、コード構文の正確性をテストし、コードが機能することを確認しました。
しかし、外部データ リソース (from: url: 'app/store/configuration.xml' から : url: ' http://webtrak.bksv.com/mel/configuration ' ) に戻すと、まだ読み取られますが、返されます。コンテンツなし。
実際のデバイスでアプリをテストしているため、これは CORS の問題が原因ではありません。
ここに私の店とモデルがあります。助けてください
Ext.define('myApp.store.SensorStationStore', {
extend: 'Ext.data.Store',
requires: ['myApp.model.SensorStation', 'Ext.data.reader.Xml'],
config:{
model: 'myApp.model.SensorStation',
storeId: 'SensorStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'http://webtrak.bksv.com/mel/configuration',
//url: 'app/store/configuration.xml',
reader: {
type: 'xml',
record: 'locations',
rootProperty: 'nmts'
}
}
}
});
Ext.define('myApp.model.SensorStation', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'name',
type: 'string',
mapping: '@name'
//convert: function (value, record) {
// Ext.Msg.alert(value,record.raw);
// //var nodes = rec.raw.querySelectorAll('');
//}
},
{
name: 'lat',
mapping: '@latitude',
type: 'float'
},
{
name: 'lng',
mapping: '@longitude',
type: 'float'
},
{
name: 'locid',
mapping:'@locid',
type: 'string'
}
]
}
});
ありがとうございました。