[code]將Ext.DatePicker年份調到左邊,月份調到右邊

來源:互聯網
上載者:User

Ext.override(Ext.DatePicker, {<br />createMonthPicker : function() {<br />if (!this.monthPicker.dom.firstChild) {<br />var buf = ['<table border="0" cellspacing="0">'];<br />for (var i = 0; i < 6; i++) {<br />buf.push('<tr>',<br />i === 0 ? '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td>'<br />: '<td class="x-date-mp-year"><a href="#" mce_href="#"></a></td><td class="x-date-mp-year"><a href="#" mce_href="#"></a></td>',<br />'<td class="x-date-mp-month"><a href="#" mce_href="#">',Date.getShortMonthName(i),'</a></td>',<br />'<td class="x-date-mp-month x-date-mp-sep"><a href="#" mce_href="#">',Date.getShortMonthName(i + 6), '</a></td></tr>');<br />}<br />buf.push('<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',<br />this.okText,<br />'</button><button type="button" class="x-date-mp-cancel">',<br />this.cancelText, '</button></td></tr>', '</table>');<br />this.monthPicker.update(buf.join(''));</p><p>this.mon(this.monthPicker, 'click', this.onMonthClick, this);<br />this.mon(this.monthPicker, 'dblclick', this.onMonthDblClick, this);</p><p>this.mpMonths = this.monthPicker.select('td.x-date-mp-month');<br />this.mpYears = this.monthPicker.select('td.x-date-mp-year');</p><p>this.mpMonths.each(function(m, a, i) {<br />i += 1;<br />if ((i % 2) === 0) {<br />m.dom.xmonth = 5 + Math.round(i * 0.5);<br />} else {<br />m.dom.xmonth = Math.round((i - 1) * 0.5);<br />}<br />});<br />}<br />}<br />});

此代碼放於Ext.reg('datepicker', Ext.DatePicker);之後即可.

可以建立一個js檔案,在ext-all.js之後載入.

 

可在此下載: http://download.csdn.net/source/2530864

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.