ExtJs4 日期 年月选择控件(转)
原文作者: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