PDA

View Full Version : ArrayStore reader problem?



parky128
26 Jan 2012, 6:03 AM
I have just encountered an issue after switching to the PR4 code where one of my stores does not seem to be reading the array data that I pass into it correctly.

Some code:


Ext.define('PinpointersTouch.model.History', {
extend: 'Ext.data.Model',
config: {
fields: [
'id',
'leaf',
'description',
'iconCls',
'TravelTimeSecs',
'DistanceTravelledMetres',
'IdlingTimeSecs',
'MinZoom',
'lat',
'lon',
'opplat',
'opplon',
'eventDT'
]
}

});




Ext.define('PinpointersTouch.store.History', {
extend: 'Ext.data.ArrayStore',
requires: 'PinpointersTouch.model.History',
config: {
model: 'PinpointersTouch.model.History'
}
});



I have a List bound to the store above and configured with an itemTpl like so:


Ext.define('PinpointersTouch.view.JourneySummaryView', {
extend: 'Ext.dataview.List',
xtype: 'journeysummaryview',
selectedUntID: null,
selectedStartDT: null,
selectedEndDT: null,
config: {
itemTpl: new Ext.XTemplate(
'<ul id="unitList">',
'<tpl for=".">',
'<li>',
'<table width="100%" cellspacing="0">',
'<tr>',
'<td style="width:16px;height:16px"><div class="{iconCls}" style="width:16px;height16px;"></div></td>',
'<td>&nbsp;{eventDT}</td>',
'</tr>',
'</table>',
'<div class="journeyCurrentLocation">{description}</div>',
'</li>',
'</tpl>',
'</ul>'),
store: 'History',
items: [{
xtype: 'toolbar',
docked: 'bottom',
ui: 'light',
items: [{
xtype: 'button',
itemId: 'btnSelectCriteria',
text: 'Select Criteria...'
},{
xtype: 'label',
html: 'Show:',
style: 'color:white;',
itemId: 'labelShow'
},{
xtype: 'selectfield',
store: 'TrackingList',
displayField: 'UnitName',
valueField: 'UntID',
itemId: 'historyUnitSelect'
},{
xtype: 'datepickerfield',
value: new Date(),
format: 'd-M-Y',
width: 150,
itemId: 'historyDateSelect'
},{
xtype: 'button',
itemId: 'btnGetHistory',
iconCls: 'download',
iconMask: true
}]
}]


}


});



I am loading the store using setData and passing in array of items, which appear like so.

0: {,…}

DistanceTravelledMetres: 286
IdlingTimeSecs: null
MinZoom: 10
SpeedKmh: null
TravelTimeSecs: 34
UpmIDs: null
UrrID: null
children: []
description: "286 metre journey from Weston Road, Long Ashton, North Somerset to Long Ashton Road, Long Ashton, North Somerset. Max speed acheived was 29mph. Used 0.05 litres of fuel. Odometer reading is 1550 miles."
eventDT: "10 Jan 14:37:40"
expanded: false
heading: null
iconCls: "Icon16 Urr12"
id: "j34017278"
lat: 51.42999
leaf: false
lon: -2.66071
mapIcon: 0
opplat: 51.42908
opplon: -2.66477
statusHTML: "<img src='http://connect.pinpointers.com/Images/icon-fuel010.gif' title='8.00% fuel'><img src='http://connect.pinpointers.com/Images/icon-ignitoff.2.gif' title='Journey End'>"
[/CODE]


When the store loads, my list renders a bunch of empty rows with horizontal separators between them. When I inspect the store I can see from the data properties that its read the id values from the data fine, but all the other fields are empty strings. This was working in PR3 fine, I haven't touched this code since switching to PR4 so I am bit confused as to what could be causing this.

Any clues please?

parky128
26 Jan 2012, 9:19 AM
I have been debugging through this issue further and notice in the buildFieldExtractors function of the Reader class there is a call to getMapping(), see line 16563 in the debug file.

This getMapping() definition does not seem to be defined anywhere in the source.

So I suspect this is why my List component doesnt show any data as the field mappings dont seem to be resolving.

Bug??

rdougan
26 Jan 2012, 8:46 PM
Could you provide us with a simple testcase which we can reproduce easily please?

Thanks.