Extjs 中的datefield 怎么设置只显示年月

2025-05-13 22:20:13
推荐回答(5个)
回答(1):

{
   xtype: "datefield",
   name: "date",
   fieldLabel: "日期",
   editable: true,
   emptyText: "--请选择--",
   format: "Y-m",//这块就是年月
   width: 180
}

format参数就是定义年月日的参数,按照自己的需求定义就好,你的是年月所以只需要写
format:"Y-m"就可以了

回答(2):

可以在后台数据库代码那里处理。如果是用的.NET 平台的话,可以在取出数据时转换成短日期类型的数据如:
****.ToShortDateString()
前台js代码也可以做类似的处理。鉴于在后台处理比较合理,在js中处理的具体的代码就不写了。

回答(3):

format:'Y-m'

回答(4):

format

回答(5):

有个插件,叫MonthPickerPlugin.js