mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-22 02:26:11 +02:00
1. Add missing _super calls. 2. Make UI widget destroys more consistent to avoid exceptions. Selectable would throw an exception in the GridField.js if destroy called from onunmatch - at that stage jQuery UI would have had called the destroy already. Add a guard, and change to onremove, which triggers before the element is removed from DOM. 3. DOM traversal fails after the element is removed from DOM. Onunmatch triggers after the removal of the element from the DOM, which makes DOM traversal fail. Use onremove instead, which triggers while the element is still in DOM.
29 lines
536 B
JavaScript
29 lines
536 B
JavaScript
(function($){
|
|
$.entwine('ss', function($){
|
|
$('.ss-toggle').entwine({
|
|
onadd: function() {
|
|
this._super();
|
|
|
|
this.accordion({
|
|
collapsible: true,
|
|
active: (this.hasClass("ss-toggle-start-closed")) ? false : 0
|
|
});
|
|
},
|
|
onremove: function() {
|
|
if (this.data('accordion')) this.accordion('destroy');
|
|
this._super();
|
|
},
|
|
|
|
getTabSet: function() {
|
|
return this.closest(".ss-tabset");
|
|
},
|
|
|
|
fromTabSet: {
|
|
ontabsshow: function() {
|
|
this.accordion("resize");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})(jQuery);
|