Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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...
commit c785f3c4923991b065dbda6768c68c8ea6872714 1 parent 7c41ff2
@mateusz mateusz authored
Showing with 9 additions and 10 deletions.
  1. +9 −10 javascript/TreeDropdownField.js
View
19 javascript/TreeDropdownField.js
@@ -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>' +
@@ -43,9 +43,6 @@
this.getPanel().hide();
this._super();
},
- onunmatch: function() {
- this._super();
- },
getPanel: function() {
return this.find('.treedropdownfield-panel');
},
@@ -260,7 +257,7 @@
});
$('.TreeDropdownField.searchable').entwine({
- onmatch: function() {
+ onadd: function() {
this._super();
var title = this.data('title');
@@ -270,9 +267,6 @@
this.setTitle(title ? title : strings.searchFieldTitle);
},
- onunmatch: function() {
- this._super();
- },
setTitle: function(title) {
if(!title && title !== '') title = strings.fieldTitle;
@@ -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');
}
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.