|
From: Thyamad c. <th...@us...> - 2006-02-15 07:31:35
|
Update of /cvsroot/thyapi/thyapi/thywidgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17768/thywidgets Modified Files: thydropdownbox_ie.js Log Message: Commiting file additions and modification from SVN revision 2797 to 2798... Changes made by vinicius on 2006-02-15 09:45:10 +0100 (Wed, 15 Feb 2006) corresponding to SVN revision 2798 with message: Corrections in the thydropdownbox, to handle correctly invoked events Index: thydropdownbox_ie.js =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/thydropdownbox_ie.js,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** thydropdownbox_ie.js 2 Feb 2006 21:50:25 -0000 1.4 --- thydropdownbox_ie.js 15 Feb 2006 07:31:26 -0000 1.5 *************** *** 67,71 **** this.defaultValue = null; ! this.lastSelected = null; this.popcontents = [ ]; --- 67,71 ---- this.defaultValue = null; ! this.lastSelected = [0,null,null]; this.popcontents = [ ]; *************** *** 79,82 **** --- 79,84 ---- }); + this.hidden = { }; + /* Essa classe deve ter os eventos onselect e onchange *************** *** 94,98 **** --- 96,105 ---- p.initThyDropDownBox = function() { + var self = this; this.contents.elm.childNodes[0]._dynobj = this; + this.contents.elm.childNodes[0].onchange = function(){ + self.invokeEvent('select', new DynEvent('select', self)); + self.invokeEvent('change', new DynEvent('change', self)); + } } *************** *** 217,221 **** p.getLastSelectedIndex = function () { ! return this.lastSelected[0]; } --- 224,232 ---- p.getLastSelectedIndex = function () { ! if (this.lastSelected[0]) ! { ! return this.lastSelected[0]; ! } ! return this.getSelectedIndex();; } *************** *** 228,232 **** p.getLastSelectedValue = function () { ! return this.lastSelected[1]; } --- 239,246 ---- p.getLastSelectedValue = function () { ! if (this.lastSelected[1]) ! { ! return this.lastSelected[1]; ! } } *************** *** 364,368 **** p.hideOption = function(params) { ! /* TODO implement this in IE */ } --- 378,398 ---- p.hideOption = function(params) { ! var options = this.contents.elm.childNodes[0].options, i; ! if (params.value) ! { ! for (i=0; i<options.length;) ! { ! if (options[i].value == params.value) ! { ! this.hidden[params.value] = options[i]; ! options[i] = null; ! return; ! } ! else ! { ! i++; ! } ! } ! } } *************** *** 381,385 **** p.showOption = function(params) { ! /* TODO implement this in IE */ } --- 411,420 ---- p.showOption = function(params) { ! var options = this.contents.elm.childNodes[0].options, i; ! if (params.value && this.hidden[params.value]) ! { ! options.add(this.hidden[params.value]); ! delete this.hidden[params.value]; ! } } *************** *** 498,512 **** this.popcontents = contents; } this._updateDOMElement(); } - //Fica dentro do _updateDOMElement - /* - if (this.dropSelected != oldSelected) - { - this.lastSelected = oldSelected; - this.invokeEvent('change', new DynEvent('change', this)); - }*/ } --- 533,541 ---- this.popcontents = contents; } + this.hidden = { }; this._updateDOMElement(); } } *************** *** 603,606 **** --- 632,636 ---- p._updateDOMElement = function() { + var oldSelected = [this.selectedIndex,this.selectedValue,this.selectedContent ]; var cont = this.popcontents; if (!this._created) *************** *** 641,645 **** } ! //ver se teve changes e chamar o metodo onchange } --- 671,679 ---- } ! if (this.selectedIndex != oldSelected[0]) ! { ! this.lastSelected = oldSelected; ! this.invokeEvent('change', new DynEvent('change', this)); ! } } *************** *** 648,653 **** \*************************************************************************/ - /** VINICIUS: assignar os eventos desse objeto ao dropdown */ - p._dropDownParentChange = function() { --- 682,685 ---- |