0
所以我有一個商店無法獲得煎茶店
Ext.define('APN.store.BackupShow', { extend: 'Ext.data.Store', requires: [ 'APN.model.ScheduledShow' ], config: { model: 'APN.model.ScheduledShow', proxy: { type: 'ajax', url: '', reader: { type: 'xml', record: 'item', rootProperty: 'xml' } } }, getShow: function() { if (this.getData().length greater 1) # by some reason stackoverflow didn't allow me to put greater sign in here; return null; // Copy field data across as wrong field is popped. this.getAt(0).set("listimage", this.getAt(0).get("onairimage")); this.getAt(0).set("isbackup", "true"); return this.getAt(0); } });
當我試圖打電話給店裏,我得到undefined
的第一個元素的元素,但該元素在店裏存在:
(0) console.log(backupShowStore); (1) console.log(backupShowStore.data); (2) console.log(backupShowStore.getData().all); (3) console.log(backupShowStore.getData().all.length); (4) console.log(backupShowStore.getData().all.getAt(0));
我回來:
(1)
Class _data: Class _model: function() { _modelDefaults: objectClass _proxy: Class _remoteFilter: false _remoteSort: false _storeId: "backupShow" _totalCount: null config: objectClass data: Class _autoFilter: true _autoSort: true _filterRoot: "data" _sortRoot: "data" all: Array[1] 0: Class _data: Object data: Object bufferingProgress: null contentlink: null description: null facebooklink: "http://www.facebook.com/mixmelbourne" id: "ext-record-45" isbackup: null listimage: null onairimage: "http://arntrnassets.mediaspanonline.com/radio/mxm/53808/on-air-default_v3.png" showbody: "Melbourne's widest variety from 2K to today, Mix101.1 with Chrissie & Jane waking up Melbourne weekdays from 6am." showbyline: "The widest variety from 2K to today" showcontentxml: null showemail: null showname: "Mix 101.1" showschedule: null smallimage: null title: null twittername: "mixmelbourne" __proto__: Object id: "ext-record-45" internalId: "ext-record-45" modified: Object phantom: true raw: item stores: Array[1] __proto__: TemplateClass length: 1 __proto__: Array[0]
(2)
_autoFilter: true _autoSort: true _filterRoot: "data" _sortRoot: "data" all: Array[1] config: objectClass dirtyIndices: true getKey: function (record) { indices: Object initConfig: function(){} initialConfig: Object items: Array[1] keys: Array[1] length: 1 map: Object __proto__: TemplateClass
(3)
Array[1] 0: Class length: 1 __proto__: Array[0]
(4)
0
(5)
Uncaught TypeError: Object [object Array] has no method 'getAt'
這是可以理解爲(5),其數組沒有方法getA t,但是商店沒有任何物品,並且由(4)表示,其中getData元素的數組等於0 ...
在這個時間點與Sencha Touch Framework非常混淆,以及如何獲得元素數組的第一個元素