[CLOSED] show only month and year in datepicker

  1. #1

    [CLOSED] show only month and year in datepicker

    is it possible to show only the moth and the year of a calender in a datefield sice for me in my date there is no days to select ?
    i tried
     <ext:DateField BlankText="Mandatory Field" ID="txtpaymentdate" runat="server" FieldLabel="Payment Date*"Width="230" ReadOnly="true" LabelSeparator="" AllowBlank="false">
     <Plugins>
    <ext:GenericPlugin ID="GenericPlugin1" runat="server" InstanceName="Ext.ux.MonthPickerPlugin" />
     </Plugins>
    </ext:DateField>
    but it give me errors ? i m still under version 0.8
    Last edited by Daniil; Sep 19, 2011 at 6:29 PM. Reason: [CLOSED]
  2. #2
    There is no such plugin for 0.8
    There is MonthPicker plugin for Ext.Net 1.0 but it cannot be used with Coolite 0.8 because that plugin is designed for ExtJS 3.x
  3. #3
    is it possible to implement the MonthPicker i saw
     <script type="text/javascript">
            Ext.ux.MonthPickerPlugin = function(config) {
                Ext.apply(this, config);
            }
     
            Ext.ux.MonthPickerPlugin.prototype = {
                init: function(picker) {
                    this.picker = picker;
                    picker.onTriggerClick = picker.onTriggerClick.createSequence(this.onClick, this);
                    picker.parseDate = picker.parseDate.createInterceptor(this.setDefaultMonthDay, this).createSequence(this.restoreDefaultMonthDay, this);
                },
     
                setDefaultMonthDay: function() {
                    this.oldDateDefaults = Date.defaults.d;
                    Date.defaults.d = 1;
                    return true;
                },
     
                restoreDefaultMonthDay: function(ret) {
                    Date.defaults.d = this.oldDateDefaults;
                    return ret;
                },
     
                first: true,
     
                onClick: function(e, el, opt) {
                    var p = this.picker.menu.picker;
                    p.activeDate = p.activeDate.getFirstDateOfMonth();
                    if (p.value) {
                        p.value = p.value.getFirstDateOfMonth();
                    }
                    p.showMonthPicker();
                    if (!p.disabled) {
                        if (this.first) {
                            // We should create the sequence functions only once.
                            this.first = false;
                            if (Ext.version < "3") {
                                p.monthPicker.slideIn = Ext.emptyFn;
                                p.monthPicker.slideOut = Ext.emptyFn;
                            } else {
                                p.monthPicker.stopFx();
                            }
     
                            if (typeof p.mun == 'function') {
                                p.mun(p.monthPicker, 'click', p.onMonthClick, p);
                                p.mun(p.monthPicker, 'dblclick', p.onMonthDblClick, p);
                            } else {
                                p.monthPicker.un('click', p.onMonthClick)
                                p.monthPicker.un('dblclick', p.onMonthDblClick)
                            }
                            p.onMonthClick = p.onMonthClick.createSequence(this.pickerClick, this);
                            p.onMonthDblClick = p.onMonthDblClick.createSequence(this.pickerDblclick, this);
                            p.mon(p.monthPicker, 'click', p.onMonthClick, p);
                            p.mon(p.monthPicker, 'dblclick', p.onMonthDblClick, p);
                        }
                        p.monthPicker.show();
                    }
                },
     
                pickerClick: function(e, t) {
                    var picker = this.picker;
                    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);
                    }
                },
     
                pickerDblclick: function(e, t) {
                    var el = new Ext.Element(t);
                    var parent = el.parent();
                    if (parent &amp;&amp; (parent.is('td.x-date-mp-month') || parent.is('td.x-date-mp-year'))) {
                        var p = this.picker.menu.picker;
                        p.setValue(p.activeDate);
                        p.fireEvent('select', p, p.value);
                    }
                }
            };
        </script>
    is there any way to implement such thing in Version 0.8
  4. #4
    I think that it is possible under 0.8.x but it requires coding (changing DatePicker javascript functionality)
    At this moment we have no ready solution (and I am doubt that we will add to 0.8 because development for 0.8 is finished, only bug fixing)
  5. #5
    Try this plugin is designed for ExtJS 2.x
    http://www.sencha.com/forum/showthre...81-MonthPicker
  6. #6
    thank you Vladimir but how to use this plugin can you explain a little bit
    thank you in advance
  7. #7
    Hi,

    Please use <ext:GenericPlugin>. Here is an example:
    http://forums.ext.net/showthread.php?10034
  8. #8
    use this
    <ext:DateField runat="server" Format="M/Y">
           <Plugins>
               <ext:MonthPicker runat="server" />
           </Plugins>
       </ext:DateField>
    Last edited by Daniil; Jul 05, 2012 at 11:13 AM. Reason: Please use [CODE] tags

Similar Threads

  1. Month/Year format need in date editor control
    By vs.mukesh in forum 1.x Help
    Replies: 2
    Last Post: Jun 02, 2014, 8:46 AM
  2. [CLOSED] DataField - display Month/year
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2011, 6:45 PM
  3. Replies: 1
    Last Post: Feb 15, 2011, 5:45 PM
  4. [CLOSED] DatePicker for year
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 13, 2011, 9:11 AM
  5. How to accept only month & year in a DateField Control ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Sep 23, 2009, 4:45 PM

Posting Permissions