Title, to the Internet or to find a good big burst of the solution to a predecessor, but there is a bit of bug, fixed here posted out, hoping to help more small partners!
$ (' #dlgReleaseTime '). Datebox ({ onshowpanel:function () {//Display The event that the month layer is not generated when the object is increasingly selected and the month layer is not created at initialization Span.trigger (' click ‘); Trigger Click event Popup Month layer if (!tds) setTimeout (function () {//Delay trigger gets month object because the event trigger above and object generation have time interval &N Bsp /tds = P.find (' div.calendar-menu-month- Inner TD '); Tds.click (fun) Ction (e) { E.stoppropagation (); Disable bubbling execution Easyui events for month var year =/\d{4}/.exec (span.html ()) [0]//Get years &NBSP ; month = parseint ($ (this). attr (' abbr '), ten);Monthbefore this is the month = parseint ($ (this). attr (' abbr '), + 1; $ (' #dlgRel Easetime '). Datebox (' Hidepanel ')//Hidden Date object &NBSP ; Datebox (' SetValue ', year + '-' + month '); Set Date value ; }) }, 0); &NB Sp }, Parser:function (s) {//config parser, return selected date &NB Sp if (!s) return new Date (); &NBSP ; var arr = s.split ('-'); return n EW Date (parseint (arr[0), parseint (Arr[1], 10) -1, 1); }, formatter:function (d) {returnd.getfullyear () + '-' + (D.getmonth () +1);}//configuration formatter, only return monthbefore this is the d.getfullyear () + '-' + (D.getmonth ());}); var p = $ (' #dlgReleaseTime '). Datebox (' panel '),//Date Select object TDS = False,//Date Selection object in month span = P.find (' Span.calendar-text '); Displays the trigger control for the month layer var curr_time = new Date (), $ ("#dlgReleaseTime"). Datebox ("SetValue", MyFormatter (Curr_time));//Set the month before// Formatted date
function MyFormatter (date) {var y = date.getfullyear (); var m = date.getmonth () + 1; var d = 1; Return y + '-' + (M < 10?) (' 0 ' + m): m);//+ '-' + (D < 10? (' 0 ' + D): D);}
<input id= "Dlgreleasetime" class= "Easyui-datebox" ></input> earlier if you choose December will become "2015-0", solve a problem, getmonth function from 0月-November! There's a problem with that solution before!
Easyui Datebox only Choose the month