mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Properly destroy tomSelect on disconnect()
This commit is contained in:
parent
f22d65cd24
commit
400cc44838
7 changed files with 44 additions and 0 deletions
|
@ -79,4 +79,10 @@ export default class extends Controller {
|
||||||
this._tomSelect = new TomSelect(this.element, settings);
|
this._tomSelect = new TomSelect(this.element, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,10 @@ export default class extends Controller {
|
||||||
//this._tomSelect.clearOptions();
|
//this._tomSelect.clearOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -84,4 +84,10 @@ export default class extends Controller {
|
||||||
|
|
||||||
return '<div>' + escape(data.text) + '</div>';
|
return '<div>' + escape(data.text) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -31,4 +31,10 @@ export default class extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -127,4 +127,10 @@ export default class extends Controller {
|
||||||
return '<div>' + level_html + escape(data.text) + image + symbol_badge + parent_badge + filter_badge + '</div>';
|
return '<div>' + level_html + escape(data.text) + image + symbol_badge + parent_badge + filter_badge + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,10 @@ export default class extends Controller {
|
||||||
|
|
||||||
this._tomSelect = new TomSelect(this.element, settings);
|
this._tomSelect = new TomSelect(this.element, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -31,6 +31,8 @@ export default class extends Controller
|
||||||
|
|
||||||
static targets = ["name", "symbol", "unit"]
|
static targets = ["name", "symbol", "unit"]
|
||||||
|
|
||||||
|
_tomSelect;
|
||||||
|
|
||||||
onItemAdd(value, item) {
|
onItemAdd(value, item) {
|
||||||
//Retrieve the unit and symbol from the item
|
//Retrieve the unit and symbol from the item
|
||||||
const symbol = item.dataset.symbol;
|
const symbol = item.dataset.symbol;
|
||||||
|
@ -116,4 +118,10 @@ export default class extends Controller
|
||||||
|
|
||||||
this._tomSelect = new TomSelect(this.nameTarget, settings);
|
this._tomSelect = new TomSelect(this.nameTarget, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
super.disconnect();
|
||||||
|
//Destroy the TomSelect instance
|
||||||
|
this._tomSelect.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue