View Full Version : Date in Xtemplate

23 Jan 2011, 10:56 PM
Hi everybody
I was following the live search example with my own data and I'm facing a problem:

No matter what date format I put in my code it always return a full date format:

My code looks like this:


var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '/extras/option/getFamilyView/'
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
id: 'patent_family_id'
}, [
{name: 'family_id', mapping: 'patent_family_id'},
{name: 'priority_date', mapping: 'priority_date', type: 'date', dateFormat: 'timestamp'},
{name: 'title', mapping: 'title'},
{name: 'constraint_flag', mapping: 'constraint_flag'}

And the Template:

// Custom rendering Template
var resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="search-item">
'{priority_date:date("d/m/Y")} | {title} | {constraint_flag} <hr>'

Let's say I want my date to be 30/01/1987, instead it shows Fri Jan 30 1987 00:00:00 GMT+1100 (Central Pacific Standard Time)

Any ideas why is doing this?

I'm using Extjs 3.3.1

Thanks in advance