[FIXED] [V0.8.2] Setting MaxDate or MinDate results in client error

  1. #1

    [FIXED] [V0.8.2] Setting MaxDate or MinDate results in client error

    Hi,

    Setting the value for MaxDate or MinDate on a DatePicker on a DateMenu (I have not checked regular, non DateMenu DatePickers) during an AjaxEvent results in a clientside javascript error. If it is set during a regular server event (such as PageLoad), no such errors occur.

    [AjaxMethod]
    public void Test()
    {
        // Set the date to a week earlier
        dateMenu.Picker.MaxDate = DateTime.Now.AddDays(-7);
    }
    Please find attached a test case. I had to rename the .rar to .rar.txt

    Any work-around is very welcome. :)
  2. #2

    RE: [FIXED] [V0.8.2] Setting MaxDate or MinDate results in client error

    Hi,

    The error occurs if you try to change MaxDate/MinDate until DatePicker show.
    MaxDate/MinDate try to update UI of picker but picker is not rendered yet

    I think it is bug of ExtJS picker, it is need to check that picker is rendered

    Try the following
    var setMaxDate = function (p, value) {
          if (p.rendered) {
               p.setMaxDate(value);
               return;
          }
          p.maxDate = value;
    }
    dateMenu.AddScript("setMaxDate({0}.picker, {1});", dateMenu.ClientID, Coolite.Utilities.DateTimeUtils.DateNetToJs(DateTime.Now.AddDays(-7)));
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    RE: [FIXED] [V0.8.2] Setting MaxDate or MinDate results in client error

    Thank you very much. I included this script on the page so the code behind can remain intact.


     		Ext.override(Ext.DatePicker, {			setMinDate: function(dt) {
    				this.minDate = dt;
    				if (this.rendered) {
    					this.update(this.value, true);
    				}
    			},
    
    
    			setMaxDate: function(dt) {
    				this.maxDate = dt;
    				if (this.rendered) {
    					this.update(this.value, true);
    				}
    			}
    		});

    Just a suggestion, perhaps something like this can be included in the Coolite script overrides thingy?

  4. #4

    RE: [FIXED] [V0.8.2] Setting MaxDate or MinDate results in client error

    Hi,

    Thanks for posting an update.


    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. [CLOSED] [1.0] setting famfamfam Icon from client side
    By webclouder in forum 1.x Premium Help
    Replies: 2
    Last Post: Jul 19, 2010, 12:03 PM
  2. Replies: 1
    Last Post: Dec 12, 2008, 2:10 PM
  3. Replies: 4
    Last Post: Nov 27, 2008, 7:45 AM
  4. Replies: 4
    Last Post: Sep 10, 2008, 5:17 AM
  5. Replies: 2
    Last Post: Feb 20, 2008, 7:05 AM

Posting Permissions