ExtJs Date format in Grid panel

后端 未结 3 1893
你的背包
你的背包 2021-01-21 03:35

How to display date in ExtJS Gridpanel column (Date with time )

Please provide syntax.

3条回答
  •  执念已碎
    2021-01-21 04:06

    1) Create your model

    Ext.define('App.model.DataWithDate', {
        extend: 'Ext.data.Model',
    
        fields: [
    //...
            {
                name: 'yourDate',
                type: 'date', //or Ext.data.Types.DATE
                dateFormat: 'time' //if you have standart json object with date value like timestamp 1387481693994
            }
    //...
        ]
    });
    

    2) For your grid config

    {
        columns: [
            {
                header: 'Date',
                dataIndex: 'yourDate',
                xtype:'datecolumn',
                renderer: Ext.util.Format.dateRenderer('d/m/Y H:i')
            }
        ]
    }
    

提交回复
热议问题