The time taken from the database in the background is formatted in JSON format and then transmitted to gridpanel. The time is changed to the format of/Date (32331121223)/. Then, the following processing is required for normal display:
In
Copy codeThe Code is as follows: var record = Ext. data. Record. create ([
{Name: 'publicdate', mapping: 'publicdate', dateFormat: 'Y-m-d', convert: function (v ){
If (v = null ){
Return null;
}
Var d = new Date ();
Var str = v. toString ();
Var str1 = str. replace ("/Date (","");
Var str2 = str1.replace (")/","");
Var dd = parseInt (str2 );
D. setTime (dd );
Return d;
}}
]);
Then in:Copy codeThe Code is as follows: var cm = new Ext. grid. ColumnModel ([
{Header: 'publication time', dataIndex: 'publicdate', width: 120, align: 'center', renderer: Ext. util. format. dateRenderer ('Y-m-d ')}
]);
This will display normally, for example, 2012-11-19,