TreeDropdownField: replace onadd by onmatch

Makes TreeDropdownField work in situations where it's moved around in the DOM (e.g. when inside a drag'n'drop container)
This commit is contained in:
Matthias Schelling 2017-09-06 09:28:33 +02:00 committed by Daniel Hensby
parent c0003bca3d
commit eacfe280c1
No known key found for this signature in database
GPG Key ID: 5DE415D786BBB2FD

View File

@ -47,7 +47,7 @@
// XMLHttpRequest // XMLHttpRequest
CurrentXhr: null, CurrentXhr: null,
onadd: function() { onmatch: function() {
this.append( this.append(
'<span class="treedropdownfield-title"></span>' + '<span class="treedropdownfield-title"></span>' +
'<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' + '<div class="treedropdownfield-toggle-panel-link"><a href="#" class="ui-icon ui-icon-triangle-1-s"></a></div>' +
@ -334,7 +334,7 @@
}); });
$('.TreeDropdownField.searchable').entwine({ $('.TreeDropdownField.searchable').entwine({
onadd: function() { onmatch: function() {
this._super(); this._super();
var title = ss.i18n._t('TreeDropdownField.ENTERTOSEARCH'); var title = ss.i18n._t('TreeDropdownField.ENTERTOSEARCH');
this.find('.treedropdownfield-panel').prepend( this.find('.treedropdownfield-panel').prepend(
@ -431,13 +431,13 @@
}); });
$('.TreeDropdownField input[type=hidden]').entwine({ $('.TreeDropdownField input[type=hidden]').entwine({
onadd: function() { onmatch: function() {
this._super(); this._super();
this.bind('change.TreeDropdownField', function() { this.bind('change.TreeDropdownField', function() {
$(this).getField().updateTitle(); $(this).getField().updateTitle();
}); });
}, },
onremove: function() { onunmatch: function() {
this._super(); this._super();
this.unbind('.TreeDropdownField'); this.unbind('.TreeDropdownField');
} }