parky128
29 Nov 2011, 4:54 AM
Hi,
Im encountering some problems when working with the store and model classes when trying to configure a model with an idProperty.
I have the following model defined:
Ext.define('PinpointersTouch.model.Unit', {
extend: 'Ext.data.Model',
fields: [
{ name: 'RowNo', type: 'int' },
'UntID',
'MapIconHTML',
'UnitName',
'EventDTLocalDisplay',
'Lat',
'Lon',
'Location',
'StatusHTML',
'InJourney',
'SwitchedOn',
'HasPower',
'UsrProfilePictureGUID',
{
name: 'EventDTLocal',
type: 'date'
}
],
idProperty: 'UntID'
});
And the following store:
Ext.define('PinpointersTouch.store.Units', {
extend: 'Ext.data.ArrayStore',
requires: 'PinpointersTouch.model.Unit',
model: 'PinpointersTouch.model.Unit'
});
After loading data into the store, I have some code which loops through the items in the store and I am trying to lookup the id values for each record (model). When I inspect the id property of the model I am seeing an auto generated id and not the value of the field I have defined in the idProperty config on the model (UntID). I know I have data loaded for the record when debugging in Chrome:
data: Object
EventDTLocal: Date
EventDTLocalDisplay: "12:47:49"
HasPower: null
InJourney: true
Lat: 52.85097
Location: "M1, Lockington-Hemington, North West Leicestershire, Leicestershire heading N at 67mph. 584 RPM"
Lon: -1.29748
MapIconHTML: "<img src='/SBS.Websites.PPTouch/images/mapicons/10001.gif'>"
RowNo: 24
StatusHTML: "<img src='/SBS.Websites.PPTouch/images/icon-fuel010.gif' title='8.00% fuel'><img src='/SBS.Websites.PPTouch/images/mapicons/110.gif' title='Timed'>"
SwitchedOn: null
UnitName: "Rob AVG650"
UntID: 7393
So I'm a bit confused here, I should be seeing an id value of 7393 based on the above but clearly I have gone wrong somewhere, can anyone assist?
Thanks
Im encountering some problems when working with the store and model classes when trying to configure a model with an idProperty.
I have the following model defined:
Ext.define('PinpointersTouch.model.Unit', {
extend: 'Ext.data.Model',
fields: [
{ name: 'RowNo', type: 'int' },
'UntID',
'MapIconHTML',
'UnitName',
'EventDTLocalDisplay',
'Lat',
'Lon',
'Location',
'StatusHTML',
'InJourney',
'SwitchedOn',
'HasPower',
'UsrProfilePictureGUID',
{
name: 'EventDTLocal',
type: 'date'
}
],
idProperty: 'UntID'
});
And the following store:
Ext.define('PinpointersTouch.store.Units', {
extend: 'Ext.data.ArrayStore',
requires: 'PinpointersTouch.model.Unit',
model: 'PinpointersTouch.model.Unit'
});
After loading data into the store, I have some code which loops through the items in the store and I am trying to lookup the id values for each record (model). When I inspect the id property of the model I am seeing an auto generated id and not the value of the field I have defined in the idProperty config on the model (UntID). I know I have data loaded for the record when debugging in Chrome:
data: Object
EventDTLocal: Date
EventDTLocalDisplay: "12:47:49"
HasPower: null
InJourney: true
Lat: 52.85097
Location: "M1, Lockington-Hemington, North West Leicestershire, Leicestershire heading N at 67mph. 584 RPM"
Lon: -1.29748
MapIconHTML: "<img src='/SBS.Websites.PPTouch/images/mapicons/10001.gif'>"
RowNo: 24
StatusHTML: "<img src='/SBS.Websites.PPTouch/images/icon-fuel010.gif' title='8.00% fuel'><img src='/SBS.Websites.PPTouch/images/mapicons/110.gif' title='Timed'>"
SwitchedOn: null
UnitName: "Rob AVG650"
UntID: 7393
So I'm a bit confused here, I should be seeing an id value of 7393 based on the above but clearly I have gone wrong somewhere, can anyone assist?
Thanks