ext plugin only shows the date years

2010-08-03  来源:本站原创  分类:Web  人气:191 

From the forum: http://www.sencha.com/forum/showthread.php?74002-3.x-Ext.ux.MonthMenu

Plug-in code:

Ext.ux.MonthPickerPlugin = function() {
    var picker;
    var oldDateDefaults; 

    this.init = function(pk) {
        picker = pk;
        picker.onTriggerClick = picker.onTriggerClick.createSequence(onClick);
        picker.getValue = picker.getValue.createInterceptor(setDefaultMonthDay).createSequence(restoreDefaultMonthDay);
        picker.beforeBlur = picker.beforeBlur.createInterceptor(setDefaultMonthDay).createSequence(restoreDefaultMonthDay);
    }; 

    function setDefaultMonthDay() {
        oldDateDefaults = Date.defaults.d;
        Date.defaults.d = 1;
        return true;
    } 

    function restoreDefaultMonthDay(ret) {
        Date.defaults.d = oldDateDefaults;
        return ret;
    } 

    function onClick(e, el, opt) {
        var p = picker.menu.picker;
        p.activeDate = p.activeDate.getFirstDateOfMonth();
        if (p.value) {
            p.value = p.value.getFirstDateOfMonth();
        } 

        p.showMonthPicker(); 

        if (!p.disabled) {
            p.monthPicker.stopFx();
            p.monthPicker.show(); 

            p.mun(p.monthPicker, 'click', p.onMonthClick, p);
            p.mun(p.monthPicker, 'dblclick', p.onMonthDblClick, p);
            p.onMonthClick = p.onMonthClick.createSequence(pickerClick);
            p.onMonthDblClick = p.onMonthDblClick.createSequence(pickerDblclick);
            p.mon(p.monthPicker, 'click', p.onMonthClick, p);
            p.mon(p.monthPicker, 'dblclick', p.onMonthDblClick, p);
        }
    } 

    function pickerClick(e, t) {
        var el = new Ext.Element(t);
        if (el.is('button.x-date-mp-cancel')) {
            picker.menu.hide();
        } else if(el.is('button.x-date-mp-ok')) {
            var p = picker.menu.picker;
            p.setValue(p.activeDate);
            p.fireEvent('select', p, p.value);
        }
    } 

    function pickerDblclick(e, t) {
        var el = new Ext.Element(t);
        if (el.parent()
            && (el.parent().is('td.x-date-mp-month')
            || el.parent().is('td.x-date-mp-year'))) { 

            var p = picker.menu.picker;
            p.setValue(p.activeDate);
            p.fireEvent('select', p, p.value);
        }
    }
}; 

Ext.preg('monthPickerPlugin', Ext.ux.MonthPickerPlugin);

Call example:

new Ext.form.DateField({
      renderTo: document.body,
      plugins:'monthPickerPlugin',
      name:'rq',
      format: 'Y-m'
  });

ext plugin only shows the date years

相关文章
  • ext plugin only shows the date years 2010-08-03

    From the forum: http://www.sencha.com/forum/showthread.php?74002-3.x-Ext.ux.MonthMenu Plug-in code: Ext.ux.MonthPickerPlugin = function() { var picker; var oldDateDefaults; this.init = function(pk) { picker = pk; picker.onTriggerClick = picker.onTrig

  • [转]Liferay 6.0.1 / EXT Plugin SDK problems with... 2012-06-14

    With app server JBoss as target you get error messages if you want to deploy your EXT Plugin. Ant deploy produces following error messages: java.lang.NoClassDefFoundError: org/apache/log4j/Level and Exception in thread "main" java.lang.NoClassDe

  • Ext grid list shows the number of rows control (to the grid tool bar plus a drop-down list) 2010-03-31

    Today I am excited, his breath did Ext experiences to share for everyone! I remember one occasion, encountered such a very painful problem! Ext is the number of rows of the grid tables show good control of the original in to the grid when you add a t

  • Myeclipse in the Ext plugin Spket installation and configuration of 2010-03-31

    Spket IDE is now supported Ext most outstanding IDE. It uses. Jsb project file file and inherit the base class and the contents of all documents generated code embedded in the tips of the Script doc. 1. Plug-in installed: Click Myeclipse Menu, Help →

  • Ext grid list shows the number of control lines (grid toolbar to add a drop-down list) 2010-03-31

    I am very excited and relieved to have their own experience to share Ext done to everyone! I remember once met such a very painful problem! Is Ext's grid table shows the number of rows to the grid in good control of the original to add a tool bar /**

  • Ext plugin Spket under MyEclipse configuration and installation 2010-04-11

    Myeclipse ext plug-ins to use in three ways: First, configure the line to use: Open myeclipse: 1, choose Help -> Software Updates -> Find and Install ...-> Search for new features to install -> New remote site ... Name: "Spket", Url:

  • [Ext plugin] QM.plugin.MutilTreeFilter: Add a filter for the tree. Start. Contractile function 2010-05-01

    Let's look at the top left corner Ext official API This plug-in can be very easy to achieve the above functions, you only need to configure your tree look plug-in, for example: plugins: ['multifilter'], This plug-in using the tree I used to do filter

  • Projects often use the Ext plugin 2010-05-03

    http://bbs.ajaxjs.com/viewthread.php?tid=2634&extra=page% 3D1 Schedule control: http://ext-scheduler.com/examples/upcoming/upcoming.html Grid Tree http://max-bazhenov.com/dev/ux.maximgb.tg/index.php Super ComboBox http://technomedia.co.uk/SuperBoxSel

  • [Ext plugin] PinyinFilter: Use the first letter of the alphabet to filter data 2010-04-19

    This plug-in designed to improve the efficiency of the user for data selection. Input data of the people must always understand that in a long list to choose your list Zhong yes a very Fei want a record of eye things; remember when networks can play

  • Ext drop-down list shows the value obtained is the actual value rather than its solution 2010-08-13

    If you write this is the case, var jsonType = [['1 ',' phone'],[' 2 ',' computer'],[' 3 ',' fridge'],[' 4 ',' TV ' ]]; There are two fields that, for the id, typeName My drop-down list is defined as fieldLabel: 'appliance type' xtype: 'combo', mode:

  • Try the date of plug-in JQuery 2009-08-01

    The new year, toss a handful of x61. Chinese New Year, a one-off coming back to clean up t61, the ssd + hard drive bays also converted to a t61 on. Braved the door card as the main risks to re-enable t61 machines, compared to T or small compared Fast

  • TreeNodeChecked v1.2 - Ext Tree Cascade selected plug-in 2009-01-27

    TreeNodeChecked is an Ext Tree cascading select plug-in, the default Ext Tree with a cascade of Checkbox is not selected functions, loading plug-ins to achieve TreeNodeChecked cascading Tree Checkbox to select functions. Demo Code: new Ext.tree.TreeP

  • Ext JS advanced Plug-in Development Guide 2010-05-03

    When you create a cross-browser rich client applications, most of us first consideration is to select a larger number of framework components. However, when the framework and does not meet our need specific components or functions when the problem wi

  • TreeGridEditor on Ext, realized editable TreeGrid components 2010-03-25

    TreeGridEditor on Ext, realized editable TreeGrid components. Main features: 1. Including the four types of edit box: text, password, select, date 2. Can be extended operation buttons, the default three functions: add, modify, delete 3. Two types of

  • struts plug-in plug-in 2010-05-09

    n Question: Sometimes you need to start loading the application to the program in the context of some of the data or perform certain operations. n Solution: Create a class implements org.apache.struts.action.PlugIn interface in struts-config.xml file

  • [Reserved] EXT Detailed core API (g) -Ext.KeyNav/KeyMap/JSON/Format/DelayedTask/TaskRunner/TextMetri 2010-12-12

    Ext.KeyNav Ext, keyNav class can provide a simple key elements Ext.Element approach Example: var el = Ext.get ("textarea"); new Ext.KeyNav (el, { "Left": function (e) { alert ("left key down"); } scope: el } ); It behaves Key

  • [Reserved] EXT core API Detailed Ext.menu.Menu (XVII) 2010-12-12

    Ext.menu.Menu Menu object config { allowOtherMenus: Boolean / / allows simultaneous display other menu? defaultAlign: String / / default alignment: tl-bl? defaults: Object / / default menu item configuration, will be applied to all items items: Mixed

  • Ext Learning Sourcebook 2008-08-18

    Easy to get ExtJS http://download.csdn.net/source/1801086 ExtJS examples of a very good source to learn Ext http://download.csdn.net/source/1736603 ExtJS project a blog system http://download.csdn.net/source/1736690 Eclipse Ext plug-in http://downloa

  • chart shows the horizontal interrupted 2010-03-30

    1, the horizontal axis on the creation date details of the more common type A form of the horizontal axis is time, vertical axis is the value described. If the density in the data and time is not the case, there is no need to remove the database time

  • ext editGridPanel dynamic header and data 2010-04-06

    Long time no write technical articles of the cups .... Recently in no mood to busy as they happened to be a recent back-Ext project data from oracle agile in the crawl out of it first to see screenshots editGridPanel in ColumnModel just a data so we