Dear friends,
I have a xml data source which contains many nodes, but I am only interested in a few of nodes.
Code:
<config generated_at="2014-04-20 17:40:24">
<nmts replicate="1" showPortables="1" tagfields="type,metric,starttime,endtime,maxtime,duration" visible="visible">
<download_queue enable="0" />
<locations name="Keilor East" download_noise_data="1" latitude="-37.73228" locid="3" longitude="144.86900" monitor_location_id="318" monitor_name="mel3" status="active" tagOrientation="SE" type="fixed" x="2857.2" y="23539.3" />
<locations name="Bulla" download_noise_data="1" latitude="-37.60686" locid="2" longitude="144.82314" monitor_location_id="320" monitor_name="mel2" status="active" tagOrientation="SE" type="fixed" x="-2247.9" y="41177.8" />
<locations name="Coolaroo" download_noise_data="1" latitude="-37.66640" locid="6" longitude="144.92731" monitor_location_id="342" monitor_name="mel6" status="active" tagOrientation="SE" type="fixed" x="9348.3" y="32808.1" />
<locations name="Essendon" download_noise_data="1" latitude="-37.73880" locid="4" longitude="144.90410" monitor_location_id="343" monitor_name="mel4" status="active" tagOrientation="SE" type="fixed" x="6764.6" y="22621.5" />
<locations name="Thomastown Fixed" download_noise_data="1" latitude="-37.67085" locid="61" longitude="144.99731" monitor_location_id="344" monitor_name="mel5" status="active" tagOrientation="SE" type="fixed" x="17140.6" y="32182.2" />
<locations name="Keilor Bonfield Res" download_noise_data="1" latitude="-37.72383" locid="60" longitude="144.83806" monitor_location_id="346" monitor_name="asa31" status="active" tagOrientation="SE" type="portable" x="-587" y="24728.6" />
</nmts>
</config>
I , for example, only want to retrieve "locations" which are in "nmts" node.
Here is my code
Code:
Ext.define('myApp.store.myStore', {
extend: 'Ext.data.Store',
model:'myApp.model.myModel',
storeId: 'myStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'http://webtrak.bksv.com/mel/configuration',
reader: {
type: 'xml',
rootProperty: 'nmts',
record:'locations'
}
}
});
and here is my model
Code:
Ext.define('myApp.model.myModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'name', type: 'string' },
{ name: 'lat', type: 'float' },
{ name: 'lng', type: 'float' },
{ name: 'locid', type: 'string' },
{ name: 'monitor_location_id', type: 'int' },
{ name: 'monitor_name', type: 'string' },
{ name: 'status', type: 'string' },
{ name: 'tagOrientation', type: 'string' },
{ name: 'stationType', type: 'string' },
{ name: 'x', type: 'float' },
{ name: 'y', type: 'float' }
]
}
});
You can see that my model only have a part of attributes from the data source.
and since the data source is on remote server I cannot test it in browsers, but when testing on devices, I cannot get any error feedback so that's the reason of making debugging impossible for me.
I am not sure whether I write the code in a right way, please point out my errors if there are any.
Thank you so much.