原文作者:http://ext4all.com/post/ext4-monthfield-with-month-picker-for-extjs4
某論壇弄下來的,。原文如下:
我也來發一個年月選擇控件,因為某些場合只需要年份和月份信息,直接使用日期控件,雖然能通過format等方式可以得到,但是還要選擇日期才能完成輸 入,比較麻煩,在網上找了一下,搜索到兩個,都是2.x版的;於是就自己動手寫一個,在4.1版中測試通過。給需要的朋友,效果如下圖:
按 Ctrl+C 復制代碼
按 Ctrl+C 復制代碼
<html > <head> <title>Insurance Report</title> <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" /> <script type="text/javascript" src="ext-all.js"></script> <script type="text/javascript" src="MonthField.js"></script> <script type="text/javascript" src="ext-lang-zh_CN.js"></script> <script type="text/javascript"> Ext.onReady(function () { var form = Ext.create('Ext.form.Panel', { renderTo: Ext.getBody(), title: 'Simple Form', height: 500, layout: 'hbox', items: [ { xtype: 'monthfield', fieldLabel: '日期', editable: false, width: 150, labelWidth: 30, labelAlign: 'right', format: 'Y-m' }, { xtype: 'monthfield', fieldLabel: '日期', editable: false, width: 150, labelWidth: 30, labelAlign: 'right', format: 'Ym' } ] }); }); </script> </head> <body > </body> </html>
DataPicker 時分秒插件:http://www.sencha.com/forum/showthread.php?137242-Ext.ux.DateTimeField-DateTimePicker-for-ext4-also-DateTimeMenu-TimePickerField