extjs datefield 设置显示和编辑格式为‘Y-m-d’

Ext.define('Contact', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'id',
        type: 'int',
        useNull: true
    }
   ,{name:'yujifahuo_date',type:"date",dateFormat:'Y-m-d'}]
});       
 var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
            saveBtnText: '保存',
            cancelBtnText: "取消", 
            listeners: {
                cancelEdit: function(rowEditing, context) {
                    // Canceling editing of a locally added, unsaved record: remove it
                    if (context.record.phantom) {
                        store.remove(context.record);
                    }
                }
            }
        });
var grid = Ext.create('Ext.grid.Panel', {
            plugins: [rowEditing],
            frame: true,
            store: store,
            iconCls: 'icon-contact',
            columns: [{
                text: 'ID',
                //width: 50,
                sortable: true,
                dataIndex: 'id',
            },
            {
                header: '预计发货时间',
                sortable: true,
                dataIndex: 'yujifahuo_date',
                field: {
                    xtype: 'datefield',format:'Y-m-d'
                },
                renderer:new Ext.util.Format.dateRenderer('Y-m-d'),
            }]
});


猜你喜欢

转载自blog.csdn.net/mahongquan/article/details/51397985