[CLOSED] DatePicker and AjaxControlToolkit

  1. #1

    [CLOSED] DatePicker and AjaxControlToolkit


    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?

    span.getTotalMilliseconds is not a function
    Line 138
    Line 138:
    Date.prototype.add = function Date$add(span) {return new Date(this.getTime() + span.getTotalMilliseconds());}
    Last edited by geoffrey.mcgill; Oct 21, 2013 at 7: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
  3. #3

    RE: [CLOSED] DatePicker and AjaxControlToolkit

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

    Geoffrey McGill
  4. #4

    RE: [CLOSED] DatePicker and AjaxControlToolkit

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

  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 7:37 PM.
  6. #6

    RE: [CLOSED] DatePicker and AjaxControlToolkit

    Thanks Geoffrey, this has been confirmed.

  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 8:09 PM.

Similar Threads

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

Posting Permissions