Reputation: 5370
In my controller i use the "record.save" function. In extjs 4.07 this would send a single record as json. I've notice in 4.1 it now send an array of the record. This is fine as i can update my server controllers to handle an array ( tho would be nice if could specify just single record )
Though my main issue is that i've been receiving the property "Id" twice in my json. Id is a property of my record class. If you look at the below Json you can see that "Id" has been appended to the end of my Json. What is the reason for this?
[{
"Id":"f3e7def0-42e6-41c9-a2ba-a04400b7c568",
"QuotedPrice":"\u00a3500.00",
"Notes":"",
"JobQuantity":"0",
"DeliveryDate":"",
"ProjectId":"",
"id":""
}]
here is my model ( i removed some of json to make it more readable )
Ext.define('Mis.model.Job', {
extend: 'Ext.data.Model',
fields: [
{
mapping: 'Id',
name: 'Id'
}
,
{
mapping: 'Value',
name: 'QuotedPrice'
},
{
mapping: 'Name',
name: 'Name'
},
{
mapping: 'JobType',
name: 'JobType'
},
{
mapping: 'ClientPo',
name: 'ClientPO'
},
{
mapping: 'FilesOver',
name: 'FilesOver'
},
{
mapping: 'PreviousJobId',
name: 'PreviousJobId'
},
{
mapping: 'EstimateValue',
name: 'Estimate'
},
{
mapping: 'SalesContact',
name: 'SalesContact'
},
{
mapping: 'AccountHandler',
name: 'AccountHandler'
},
{
mapping: 'AssemblyTime',
name: 'AssemblyTime'
},
{
mapping: 'DespatchDate',
name: 'DespatchDate'
},
{
mapping: 'ProductionFiles',
name: 'ProductionFiles'
},
{
mapping: 'Notes',
name: 'Notes'
},
{
mapping: 'Quantity',
name: 'JobQuantity'
},
{
mapping: 'DeliveryDate',
name: 'DeliveryDate'
},
{
mapping: 'ProjectId',
name: 'ProjectId'
}
],
proxy: {
type: 'ajax',
url: 'https://www.xxx.localhost/',
api:
{
read: '/Jobs/Read/' + jId,
update: '/Jobs/Update',
create: '/Jobs/Update',
destroy: '/Jobs/Remove'
},
reader: {
type: 'json',
root: 'Jobs',
successProperty: 'success',
totalProperty: 'Total'
}
}
});
Upvotes: 0
Views: 750