Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BUG Adjust the tree construction and triggers to work with IE.
After Hamish's suggestion. Entwine onchange would not get executed in
IE8 at all, which would have the effect of the displyed dropdown
selection not being set.

Change to onadd also mandates the changes to onadd on other parts of the
tree component - otherwise the change event can trigger before the
tree elements are added to the DOM.
  • Loading branch information
mateusz committed Jul 12, 2012
1 parent 7c41ff2 commit c785f3c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions javascript/TreeDropdownField.js
Expand Up @@ -29,7 +29,7 @@
* @todo Expand title height to fit all elements
*/
$('.TreeDropdownField').entwine({
onmatch: function() {
onadd: function() {
this.append(
'<span class="treedropdownfield-title"></span>' +
'<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' +
Expand All @@ -43,9 +43,6 @@
this.getPanel().hide();
this._super();
},
onunmatch: function() {
this._super();
},
getPanel: function() {
return this.find('.treedropdownfield-panel');
},
Expand Down Expand Up @@ -260,7 +257,7 @@
});

$('.TreeDropdownField.searchable').entwine({
onmatch: function() {
onadd: function() {
this._super();

var title = this.data('title');
Expand All @@ -270,9 +267,6 @@

this.setTitle(title ? title : strings.searchFieldTitle);
},
onunmatch: function() {
this._super();
},
setTitle: function(title) {
if(!title && title !== '') title = strings.fieldTitle;

Expand Down Expand Up @@ -372,8 +366,13 @@
});

$('.TreeDropdownField input[type=hidden]').entwine({
onchange: function() {
this.getField().updateTitle();
onadd: function() {
this.bind('change.TreeDropdownField', function() {
$(this).getField().updateTitle();
});
},
onremove: function() {
this.unbind('.TreeDropdownField');
}
});
});
Expand Down

0 comments on commit c785f3c

Please sign in to comment.