[CLOSED] DatePicker and AjaxControlToolkit

  1. #1

    [CLOSED] DatePicker and AjaxControlToolkit

    Hello,

    Was wondering if there was any resolution to the JavaScript error generated when using the AjaxControlToolkit and the Ext JS DatePicker on the same form?

    Error:
    span.getTotalMilliseconds is not a function
    http://localhost/ScriptResource.axd?d=3w3a_SAQmS1uxac2mFuXNv42qGCxnU_B-6oAeibCDs4tph4A5CmcJALQNPZJqHBc2rGornuRSRIRHsIEmYXBUg2&t=633673529779413340
    Line 138
    Line 138:
    Date.prototype.add = function Date$add(span) {return new Date(this.getTime() + span.getTotalMilliseconds());}
    Cheers,
    Timothy
    Last edited by geoffrey.mcgill; Oct 21, 2013 at 8:23 PM.
  2. #2

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    hmm... ExtJS does not modify nor use the .getTotalMilliseconds() function. I'll have to create a sample and debug further.

    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    I was able to reproduce the problem. Just stepping through the code now.

    Geoffrey McGill
    Founder & CEO
  4. #4

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    Thanks! Let me know if you need me to test anything.

    Cheers
  5. #5

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    Hi Timothy,

    The problem is caused by a nasty flaw of both the micorosft and extjs libraries. I've added a work-around that solved the problem when using the <ext:DatePicker> in conjunction with the AjaxControlToolkit.

    The fix has been committed to SVN.
    Last edited by geoffrey.mcgill; Dec 17, 2019 at 8:37 PM.
  6. #6

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    Thanks Geoffrey, this has been confirmed.

    Cheers,
    Timothy
  7. #7
    It appears the following was added to the top of the DateField.js file to work-around this AjaxControlToolkit issue:

    // @source core/form/DateField.js
    
    Date.prototype.extadd = Date.prototype.add;
    
    /* 
        Create override of Date.prototype.add function to work 
        around collision when using Microsoft AjaxControlToolkit 
    */
    Ext.DatePicker.prototype.initComponent = Ext.DatePicker.prototype.initComponent.createInterceptor(function () {
        if (!this.msadd) {
            Date.prototype.msadd = Date.prototype.add;
            
            Date.prototype.add = function () {
                return this[typeof arguments[0] === "string" ? "extadd" : "msadd"].apply(this, arguments);
            };
        }
    });
    The original commit of this fix occurred on 2009-06-03.

    Hope this helps.
    Last edited by geoffrey.mcgill; Dec 17, 2019 at 9:09 PM.

Similar Threads

  1. [CLOSED] datepicker event
    By dev in forum 1.x Premium Help
    Replies: 7
    Last Post: Sep 01, 2010, 2:26 PM
  2. [CLOSED] DatePicker:
    By RomualdAwessou in forum 1.x Premium Help
    Replies: 8
    Last Post: Jul 09, 2010, 3:50 PM
  3. [CLOSED] datepicker from to example
    By LeeTheGreek in forum 1.x Premium Help
    Replies: 3
    Last Post: Apr 04, 2010, 3:29 PM
  4. [CLOSED] DatePicker
    By Timothy in forum 1.x Premium Help
    Replies: 3
    Last Post: Dec 18, 2008, 5:31 AM
  5. [CLOSED] Datepicker help
    By Jurke in forum 1.x Help
    Replies: 13
    Last Post: Sep 22, 2008, 7:52 AM

Posting Permissions