Problem exteding Ext.form.DateField

March 13th, 2010
  • Hi,

    I磎 subclassing the Ext.form.DateField to change the return value of getValue(). The value is being returned the way I expect but there磗 a problem in the behavior of the button in the component. First time I click on it, everything works fine, but when I click it again, Firebug tells me:

    B.clearTime is not a function
    initComponent("14/04/2008")ext-all.js (line 85)
    initComponent()ext-all.js (line 128)
    EventManager(Object browserEvent=Event resize button=-1 type=resize)ext-all.js (line 13)
    getViewWidth(click clientX=0, clientY=0)ext-base.js (line 10)
    [Break on this error] Ext.DatePicker=Ext.extend(Ext.Component,{todayText :"Today",okText:" OK ...
    Above is the code of the sub-class:

    // Create user extensions namespace (Ext.ux)
    Ext.namespace('Ext.aquajax');

    /**
    * Ext.aquajax.AquaDateField
    *
    * @author Raphael Rissato
    * @version 1.0
    *
    * @class Ext.aquajax.AquaDateField
    * @extends Ext.form.DateField
    * @constructor
    * @param {Object} config Configuration options
    */


    Ext.aquajax.AquaDateField = function(config) {

    // chamando construtor pai.
    Ext.aquajax.AquaDateField.superclass.constructor.c all(this, config);
    };


    Ext.extend(Ext.aquajax.AquaDateField, Ext.form.DateField, {

    getValue: function(value) {
    return Ext.aquajax.AquaDateField.superclass.getRawValue.c all(this);
    }
    });

    Does anyone know any solution for this? Thank磗!


  • Hi there, i had the same problem.
    I solved it overriding the method onTriggerClick too.

    onTriggerClick : function(){
    if(this.disabled){
    return;
    }
    if(this.menu == null){
    this.menu = new Ext.menu.DateMenu();
    }
    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))
    });
    this.menu.on(Ext.apply({}, this.menuListeners, {
    scope:this
    }));
    this.menu.picker.setValue(this.parseDate(this.getV alue()) new Date());
    this.menu.show(this.el, "tl-bl?");
    }

    I onlychanged the bold part.


  • You must break it somehow in the click handler. Show us more code, you have the extend bit correct AFAICS.


  • There磗 no more changes on the code. All I wanted to change was the getValue() method. I figured out something interesting. The problem dissapears when the field is empty. It must have something to do with the return type, since getValue() returns Date and getRawValue returns mixed. Maybe there磗 a call to getValue() inside the handler.

    I磎 still trying to solve this. Any help is welcome. Thanks!







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Problem exteding Ext.form.DateField , Please add it free.