Jonathan Druart
c036f58eeb
Use the Composition API to have this destroy code in a single place. Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
11 lines
278 B
JavaScript
11 lines
278 B
JavaScript
import { onBeforeUnmount } from "vue";
|
|
|
|
export function useDataTable(table_id) {
|
|
onBeforeUnmount(() => {
|
|
if ($.fn.DataTable.isDataTable("#" + table_id)) {
|
|
$("#" + table_id)
|
|
.DataTable()
|
|
.destroy(true);
|
|
}
|
|
});
|
|
}
|