1. #1
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default Changes in 3.1

    Changes in 3.1


    Hi,

    just wondering but after update the object structure in handlers of datepicker changed completely, so i had to adjust my scripts. What is the reason for, and which drastic changes are done too? Is there any doc or summary which structures changed too? It's hard to get this if you stop read the forum for a short while, and changes are not backward compatible.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,054
    Vote Rating
    659
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The public API for the DatePicker didn't change, if I remember correctly. What are you referring to?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    This is the code which worked well with 3.0 and stopped working with 3.1:
    Code:
    var menu = new Ext.menu.DateMenu({
    	id:			'p' + element.dom.id,
    	format:		format[index],
    	value:		Date.parseDate(element.dom.value, format[index]),
    	handler: 	function(picker, date){
    		var relElement = Ext.getDom(picker.id.substring(1));
    		relElement.value = date.format(format[index]);
    		if (Ext.isFunction(relElement.onchange)) {
    			relElement.onchange.call(relElement);
    		}
    	},
    	listeners:	{
    		beforeshow:	function(picker) {
    			var relElement = Ext.getDom(picker.id.substring(1));
    			if (relElement.value) {
    				Ext.getCmp('p' + relElement.id).setValue(Date.parseDate(relElement.value, format[index]));
    			}
    		}
    	}
    });
    Here is the new code that works now:
    Code:
    var menu = new Ext.menu.DateMenu({
    	id:			'p' + element.dom.id,
    	format:		format[index],
    	value:		Date.parseDate(element.dom.value, format[index]),
    	handler: 	function(picker, date){
    		var relElement = Ext.getDom(picker.ownerCt.id.substring(1));
    		relElement.value = date.format(format[index]);
    		if (Ext.isFunction(relElement.onchange)) {
    			relElement.onchange.call(relElement);
    		}
    	},
    	listeners:	{
    		beforeshow:	function(picker) {
    			var relElement = Ext.getDom(picker.picker.ownerCt.id.substring(1));
    			if (relElement.value) {
    				picker.picker.setValue(Date.parseDate(relElement.value, format[index]));
    			}
    		}
    	}
    });
    The change is the picker object in handler and beforeshow listener.
    Last edited by mystix; 27 Jan 2010 at 1:21 AM. Reason: highlighted changes in red for readability
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Thread Participants: 1