1. #61
    Ext User
    Join Date
    Jan 2008
    Posts
    6
    Vote Rating
    0
    pcsernyik is on a distinguished road

      0  

    Default


    Great!! Thank you!

  2. #62
    Ext User nassaja-rus's Avatar
    Join Date
    Mar 2007
    Location
    Russia
    Posts
    314
    Vote Rating
    1
    nassaja-rus is on a distinguished road

      0  

    Default


    Can you add "submitFormat" property? For date formating on submit like in Ext.ux.form.XDateField plugin?
    -= miu-miu =-

    Linux, Perl, GNU, Open Source, Ajax, Ubuntu 9.04

  3. #63
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    888
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by nassaja-rus View Post
    Can you add "submitFormat" property? For date formating on submit like in Ext.ux.form.XDateField plugin?
    It's already implemented for DateFieldPlus by default
    I only missed it in the docs...updated now.

  4. #64
    Ext User
    Join Date
    Feb 2008
    Posts
    11
    Vote Rating
    0
    Nohcs777 is on a distinguished road

      0  

    Default


    Quote Originally Posted by wm003 View Post
    Yes,please! That would be very interesting in how you accomplished it
    Sorry i haven't gotten back sooner. I finished this last week (or at least all I could justify).

    I augmented the Ext.ux.form.DateFieldPlus type as I figured it would be easier for your integration than if I had just extended your type. Additionally, given the event model, I also had to slightly modify your Ext.ux.DatePickerPlus.setValue() to handle arrays.

    At this point it populates the field w/ a (customizable) delimeter which will handle validation. Unfortunately I didn't have time to figure out how to get the DatePicker to reset the values selected based on if the user changes the values in the field as I didn't want to spend time understanding the difference between preselected[] vs selected[] and handling the management of that.

    I hope this helps. Thx.

    Code:
      
    //augmented Ext.ux.form.DateFieldPlus to handle multiselection
    Ext.ux.form.DateFieldPlus= Ext.extend(Ext.form.DateField, {
       usePickerPlus: true,
       showWeekNumer: true,
       eventDates: [],
       noOfMonth : 1,
       noOfMonthPerRow : 3,
       nationalHolidaysCls: 'x-datepickerplus-nationalholidays',
       markNationalHolidays:true,
       eventDates: function(year) {
        return [];
       },
       eventDatesRE : false,
       eventDatesRECls : '',
       eventDatesREText : '', 
       multiSelectByCTRL: true, 
       fillupRows: true,
       multiSelection: false,
       multiSelectionDelimiter: ',',
       markWeekends:true,
       weekendText:'',
       weekendCls: 'x-datepickerplus-weekends',
       weekendDays: [6,0],
       useQuickTips: true,
       pageKeyWarp: 1,
       maxSelectionDays: false,
       resizable: false,
       renderTodayButton: true,
       renderOkUndoButtons: true,
       tooltipType: 'qtip',
       allowedDates : false,
       allowedDatesText : '',
       onAfterMonthClick : function(picker, month, wasSelected){
        this.fireEvent("aftermonthclick", this, month, wasSelected, picker);
       },
       onAfterWeekClick : function(picker, startOfWeek, wasSelected){
        this.fireEvent("afterweekclick", this, startOfWeek, wasSelected, picker);
       },
       onAfterDateClick : function(picker, date, wasSelected){
        this.fireEvent("afterdateclick", this, date, wasSelected, picker);
       },
       onTriggerClick : function(){
        if(this.disabled){
         return;
        }
        if(!this.menu){
         this.menu = new Ext.menu.DateMenu({
    //is needed at initialisation               
          usePickerPlus:this.usePickerPlus,
          noOfMonth:this.noOfMonth,
          noOfMonthPerRow:this.noOfMonthPerRow,
          listeners: {
           'afterdateclick': {fn:this.onAfterDateClick,scope:this},
           'aftermonthclick': {fn:this.onAfterMonthClick,scope:this},
           'afterweekclick': {fn:this.onAfterWeekClick,scope:this}       
          }
         });
        }
     
     
        Ext.apply(this.menu.picker,  {
         minDate : this.minValue,
         maxDate : this.maxValue,
         disabledDatesRE : this.ddMatch,
         disabledDatesText : this.disabledDatesText,
         disabledDays : this.disabledDays,
         disabledDaysText : this.disabledDaysText,
         format : this.format,
         minText : String.format(this.minText, this.formatDate(this.minValue)),
         maxText : String.format(this.maxText, this.formatDate(this.maxValue)),
         showWeekNumber: this.showWeekNumber,
         nationalHolidaysCls: this.nationalHolidaysCls,
         markNationalHolidays:this.markNationalHolidays,
         multiSelectByCTRL: this.multiSelectByCTRL, 
         fillupRows: this.fillupRows,
         multiSelection: this.multiSelection,
         markWeekends:this.markWeekends,
         weekendText:this.weekendText,
         weekendCls: this.weekendCls,
         weekendDays: this.weekendDays,
         useQuickTips: this.useQuickTips,
         eventDates: this.eventDates,
         eventDatesRE: this.eventDatesRE,
         eventDatesRECls: this.eventDatesRECls,
         eventDatesREText: this.eventDatesREText,
         pageKeyWarp: this.pageKeyWarp,
         maxSelectionDays: this.maxSelectionDays,
         resizable: this.resizable,
         renderTodayButton: this.renderTodayButton,
         renderOkUndoButtons: this.renderOkUndoButtons,
         allowedDates : this.allowedDates,
         allowedDatesText : this.allowedDatesText
        });
        this.menu.on(Ext.apply({}, this.menuListeners, {
         scope:this
        }));
        this.menu.picker.setValue(this.getValue() || new Date());
        this.menu.show(this.el, "tl-bl?");
       },
     
       /**
        * @param date || Array of dates
        * @description override setValue() function to handle arrays.
        * additionally, probably should change DatePickerPlus to throw a 'okclicked' event 
        * instead of select to differenciate it from 'select' since its really only applicable 
        * under the single select senario
        */
          setValue : function(date){
     
           var field = this;     
     
           if (Ext.isArray(date))
           {
            var formatted = [];
         Ext.each(date, function(item, index, array) {
          formatted.push(field.formatDate(item));
         });
     
         var value = formatted.join(this.multiSelectionDelimiter);
     
         //bypass setValue validation on Ext.DateField
            Ext.form.DateField.superclass.setValue.call(this, value);
           }
           else 
           {
               Ext.ux.form.DateFieldPlus.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
           }
          },
    
    /** * @description override to handle delimited string values */
    validateValue : function(value){ var field = this; if (value.indexOf(this.multiSelectionDelimiter) > -1) { var values = value.split(this.multiSelectionDelimiter); var isValid = true; Ext.each(values, function(item, index, array) { if (!Ext.ux.form.DateFieldPlus.superclass.validateValue.call(field, item)) isValid = false; }); return isValid; } else { return Ext.ux.form.DateFieldPlus.superclass.validateValue.call(this, value); } }, /** * @description override to handle delimited string values */ getValue : function() { var value = Ext.form.DateField.superclass.getValue.call(this); if (value.indexOf(this.multiSelectionDelimiter) > -1) { var field = this; var values = value.split(this.multiSelectionDelimiter); var dates = []; Ext.each(values, function(item, index, array) { dates.push(field.parseDate(item) || ""); }); return dates; } else { return Ext.ux.form.DateFieldPlus.superclass.getValue.call(this); } }, submitFormat:'Y-m-d', submitFormatAddon: '-format', onRender:function() { Ext.ux.form.DateFieldPlus.superclass.onRender.apply(this, arguments); //be sure not to have duplicate formfield names (at least IE moans about it and gets confused) this.name = (typeof this.name=="undefined"?this.id+this.submitFormatAddon:(this.name==this.id?this.name+this.submitFormatAddon:this.name)); this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name:this.name}); this.hiddenName = this.name; this.el.dom.removeAttribute('name'); this.el.on({ keyup:{scope:this, fn:this.updateHidden} ,blur:{scope:this, fn:this.updateHidden} }); this.setValue = this.setValue.createSequence(this.updateHidden); if(this.tooltip){ if(typeof this.tooltip == 'object'){ Ext.QuickTips.register(Ext.apply({ target: this.trigger }, this.tooltip)); } else { this.trigger.dom[this.tooltipType] = this.tooltip; } } }, updateHidden:function() { var value = this.getValue(); if(Ext.isDate(value)) { this.hiddenField.dom.value = Ext.util.Format.date(value, this.submitFormat); } else { this.hiddenField.dom.value = value; } } }); Ext.reg('datefieldplus', Ext.ux.form.DateFieldPlus); } }
    Code:
    //slight change (snippet) to Ext.ux.DatePickerPlus
    
    setValue : function(value){ // var old = this.value;
    if (Ext.isArray(value)) { //I expected this to work but apparently there is more going on here w/ selected vs preselected than I understand. //leaving for future augmenting by the author. this.setSelectedDates(value, true); } else { this.value = value.clearTime(true); if(this.el && !this.multiSelection && this.noOfMonth==1){ this.update(this.value); } }
    }

  5. #65
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    888
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by Nohcs777 View Post
    Sorry i haven't gotten back sooner. I finished this last week (or at least all I could justify).

    I augmented the Ext.ux.form.DateFieldPlus type as I figured it would be easier for your integration than if I had just extended your type. Additionally, given the event model, I also had to slightly modify your Ext.ux.DatePickerPlus.setValue() to handle arrays.

    At this point it populates the field w/ a (customizable) delimeter which will handle validation. Unfortunately I didn't have time to figure out how to get the DatePicker to reset the values selected based on if the user changes the values in the field as I didn't want to spend time understanding the difference between preselected[] vs selected[] and handling the management of that.

    I hope this helps. Thx.
    Great! Thanks, i'm gonna test it more deeply (and integration with the selection and preselection you mentioned). There will still be missing some kind of parser for manual field entries.

  6. #66
    Ext User
    Join Date
    Feb 2008
    Posts
    11
    Vote Rating
    0
    Nohcs777 is on a distinguished road

      0  

    Default


    Quote Originally Posted by wm003 View Post
    Great! Thanks, i'm gonna test it more deeply (and integration with the selection and preselection you mentioned). There will still be missing some kind of parser for manual field entries.
    The DateField already uses Date.Parse() which is what I am using for each item in the delimited list to provide validation (see validateValue()) and then subsequently for creating the array via getValue() to be passed to setSelectedValues(). Is there any reason to go beyond this if this is what the native DateField supports?

  7. #67
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    888
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by Nohcs777 View Post
    The DateField already uses Date.Parse() which is what I am using for each item in the delimited list to provide validation (see validateValue()) and then subsequently for creating the array via getValue() to be passed to setSelectedValues(). Is there any reason to go beyond this if this is what the native DateField supports?
    ahh, sorry, missed that. Of course theres no more reason to go beyond this then

  8. #68
    Ext User
    Join Date
    Apr 2008
    Posts
    2
    Vote Rating
    0
    catapl3xis is on a distinguished road

      0  

    Default


    Hi and thanks for the great extension! Is there a method or property to get the current months that are visible in calendar? I want to fetch data for only those months that the user can see (so I need to known which they are). And of course it would be nice if there was an event when the user moves to view a different month(s)...

  9. #69
    Sencha User
    Join Date
    Oct 2007
    Location
    Berlin, Germany
    Posts
    888
    Vote Rating
    9
    wm003 will become famous soon enough

      0  

    Default


    Quote Originally Posted by catapl3xis View Post
    Hi and thanks for the great extension! Is there a method or property to get the current months that are visible in calendar? I want to fetch data for only those months that the user can see (so I need to known which they are).
    Well, you can easily calculate these months:

    PHP Code:
    var startmonth datepickerplus.activeDate.getMonth();
    var 
    endmonth startmonth+datepickerplus.noOfMonth-1;

    var 
    visibleMonths_Numbers = [];
    var 
    visibleMonths_Names = [];
    for (;
    startmonth<=endmonth;startmonth++) {
        
    visibleMonths_Numbers.push(startmonth);
        
    visibleMonths_Names.push(Date.monthNames[startmonth]);

    Quote Originally Posted by catapl3xis View Post
    And of course it would be nice if there was an event when the user moves to view a different month(s)...
    Sure, it's easy i'll put that in the upcoming final release

  10. #70
    Ext User
    Join Date
    Apr 2008
    Posts
    2
    Vote Rating
    0
    catapl3xis is on a distinguished road

      0  

    Default


    Quote Originally Posted by wm003 View Post
    Well, you can easily calculate these months:

    PHP Code:
    var startmonth datepickerplus.activeDate.getMonth(); 
    Mmm what's that mysterious 'activeDate' property? It's not on Ext API or on your docs.. you might want to add it

    Sure, it's easy i'll put that in the upcoming final release
    Great, I look forward to seeing that!

Thread Participants: 111

  1. galdaka (1 Post)
  2. wehtam (5 Posts)
  3. nassaja-rus (1 Post)
  4. mystix (5 Posts)
  5. ludoo (1 Post)
  6. jsakalos (1 Post)
  7. laluigino (2 Posts)
  8. evant (1 Post)
  9. methodz (1 Post)
  10. stevebla (1 Post)
  11. netnoise (1 Post)
  12. KampfCaspar (1 Post)
  13. carstep (2 Posts)
  14. ZooKeeper (1 Post)
  15. nromanel (6 Posts)
  16. Spirit (1 Post)
  17. yuewah (4 Posts)
  18. chemist458 (3 Posts)
  19. jerrybrown5 (3 Posts)
  20. gtomalesky (5 Posts)
  21. jo2008 (1 Post)
  22. aacraig (7 Posts)
  23. stumpy_uk (2 Posts)
  24. hattia (3 Posts)
  25. lpfLoveExt (1 Post)
  26. thoreking (3 Posts)
  27. markusreimers (1 Post)
  28. sigaref (2 Posts)
  29. andreabat (1 Post)
  30. sanjshah (6 Posts)
  31. mask_hot (4 Posts)
  32. dorgan (1 Post)
  33. bornsilly (1 Post)
  34. Zord (3 Posts)
  35. aaronchiang (1 Post)
  36. skbach (5 Posts)
  37. joenilson (2 Posts)
  38. S1-Gezi (1 Post)
  39. pcsernyik (6 Posts)
  40. vizcano (1 Post)
  41. Richie1985 (2 Posts)
  42. radtad (6 Posts)
  43. tagsum (3 Posts)
  44. Nohcs777 (5 Posts)
  45. lavitsky (1 Post)
  46. Hunyi (1 Post)
  47. brenda (3 Posts)
  48. hp (2 Posts)
  49. Dave.Sanders (4 Posts)
  50. DVSDevise (3 Posts)
  51. moegal (3 Posts)
  52. EzBulka (1 Post)
  53. catapl3xis (2 Posts)
  54. rvrdesigns (2 Posts)
  55. rich02818 (5 Posts)
  56. armandoxxx (2 Posts)
  57. WhiteRussian (4 Posts)
  58. lacco (1 Post)
  59. Ronhead (3 Posts)
  60. Urkman (1 Post)
  61. descheret (3 Posts)
  62. dimitrij.zub (1 Post)
  63. hirenb (1 Post)
  64. sasho (7 Posts)
  65. CR_RedFox (1 Post)
  66. joshuabco (1 Post)
  67. apimio (4 Posts)
  68. sirtimbly (2 Posts)
  69. canxss (2 Posts)
  70. SimoAmi (2 Posts)
  71. wemerson.januario (1 Post)
  72. dubdub (3 Posts)
  73. Naokai (5 Posts)
  74. RuiDC (4 Posts)
  75. dkarlsso (1 Post)
  76. slisbin (1 Post)
  77. Chods (2 Posts)
  78. dkroells (3 Posts)
  79. alvaro1728 (1 Post)
  80. sneema (15 Posts)
  81. AdamLShepherd (2 Posts)
  82. bholyoak (2 Posts)
  83. dtex-lab (1 Post)
  84. EZboy (2 Posts)
  85. burbur (1 Post)
  86. strad84 (2 Posts)
  87. radubrehar (4 Posts)
  88. almotasim (2 Posts)
  89. itheart (1 Post)
  90. fmntf (4 Posts)
  91. Allbus (2 Posts)
  92. sprakash (2 Posts)
  93. sansie (3 Posts)
  94. siebe vos (6 Posts)
  95. gkarmadi (1 Post)
  96. fabads (16 Posts)
  97. kskrumpet (4 Posts)
  98. sivanesan (1 Post)
  99. marco81 (1 Post)
  100. Lobo (2 Posts)
  101. benoitrx (1 Post)
  102. JazzMan88 (3 Posts)
  103. Urzzza (1 Post)
  104. josefhaydn (2 Posts)
  105. eja40 (3 Posts)
  106. lukasw44 (1 Post)
  107. thchuong (1 Post)
  108. twhra (1 Post)
  109. ronei (1 Post)
  110. qdano (1 Post)
  111. quintenvk (1 Post)

Tags for this Thread