PDA

View Full Version : Field convert method not getting called



jkt721
15 Sep 2010, 7:37 AM
I have a model with a convert function that takes a long and returns a date object



Ext.regModel('Data', {
fields: ['id',
'account',
'amount',
'category',
{
name: 'date',
type: 'date',
convert: function(v){ return new Date(v)}
},
'description']
});


When I try and use it in a template date is still returning the original long 1283403600000



tpl: '<tpl for="."><div class="dataList">'+
'<div class="amount">'+
'{amount}</div>'+
'{date}<br/>'+
'{description}'+
'</div>'+
'</tpl>'


Some sample JSON



[{
id: 2315,
account: 3,
amount: -15.88,
category: "MISC",
date: 1283403600000,
description: "A"
},
{
id: 2316,
account: 3,
amount: -38.42,
category: "MISC",
date: 1283403600000,
description: "B"
},
{
id: 2317,
account: 3,
amount: -23.72,
category: "MISC",
date: 1283490000000,
description: "C"
}]


Any ideas what I'm doing wrong?