修改extjs控件,支持只选择年月,或者只选择年。 只要设置format:“Y-m”,"Y"即可。 xtype:'monthfield' 因为extjs的bug(3月30如果选择2月将自动变成3月)。所以需要修改monthField中safeParse方法: else if ("Y-m"==format) { // set time to 12 noon, then clear the time var parsedDate = Date.parseDate(value + '-01 ' + this.initTime, format + '-d ' + this.initTimeFormat); if (parsedDate) return parsedDate.clearTime(); } else if ("Ym"==format) { // set time to 12 noon, then clear the time var parsedDate = Date.parseDate(value + '01 ' + this.initTime, format + 'd ' + this.initTimeFormat); if (parsedDate) return parsedDate.clearTime(); }
2022-03-20 10:33:46 12KB extjs 年月控件 年份控件
1
Extjs DateField控件 - 只选择年份(找了很久发现网上只有选择年月的控件,于是基于extjs年月控件设计了只选择年份的控件)
2019-12-21 19:40:22 5KB extjs
1