Skip to content

Commit 9833ed1

Browse files
committed
remove beforeDestroy
1 parent e99f0f5 commit 9833ed1

9 files changed

+67
-71
lines changed

Diff for: dist/index.js

+9-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"/index.js": "/index.js?id=3a1f50c265144aaa7e50"
2+
"/index.js": "/index.js?id=2e55ab288c75c2a1b2ce"
33
}

Diff for: example/index.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* vue-datatables-net
33
* Vue jQuery DataTables.net wrapper component
44
*
5-
* @version v1.5.0
5+
* @version v1.5.1
66
77
* @repository https://github.com/niiknow/vue-datatables-net.git
88
*/
@@ -770,8 +770,15 @@ var myUniqueId = 1;
770770
// const rows = event.dataTable.rows( event.indexes )
771771
// const data = rows.data()
772772
});
773-
} // wire up edit, delete, and/or action buttons
773+
}
774+
775+
$el.find('#vdtnetable1_wrapper').on('remove', function () {
776+
if (that.dataTable) {
777+
that.dataTable.destroy(true);
778+
}
774779

780+
that.dataTable = null;
781+
}); // wire up edit, delete, and/or action buttons
775782

776783
$el.on('click', '[data-action]', function (e) {
777784
e.preventDefault();
@@ -851,15 +858,6 @@ var myUniqueId = 1;
851858
that.reload();
852859
}
853860
},
854-
beforeDestroy: function beforeDestroy() {
855-
var that = this;
856-
857-
if (that.dataTable) {
858-
that.dataTable.destroy(true);
859-
}
860-
861-
that.dataTable = null;
862-
},
863861
methods: {
864862
/**
865863
* Vue.compile a template string and return the compiled function

Diff for: example/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: example/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"/index.js": "/index.js?id=fb6edaa8b910f9bad451"
2+
"/index.js": "/index.js?id=98012e669c8c525049fb"
33
}

Diff for: package-lock.json

+34-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-datatables-net",
33
"description": "Vue jQuery DataTables.net wrapper component",
4-
"version": "1.5.0",
4+
"version": "1.5.1",
55
"author": "[email protected]",
66
"license": "MIT",
77
"main": "dist/index.js",
@@ -45,7 +45,7 @@
4545
"datatables.net-responsive-bs4": "^2.2.7",
4646
"datatables.net-select-bs4": "^1.3.3",
4747
"eslint": "^7.24.0",
48-
"eslint-config-prettier": "^8.1.0",
48+
"eslint-config-prettier": "^8.2.0",
4949
"eslint-friendly-formatter": "^4.0.1",
5050
"eslint-plugin-vue": "^7.9.0",
5151
"eslint-webpack-plugin": "^2.5.3",
@@ -54,6 +54,6 @@
5454
"vue": "^2.6.12",
5555
"vue-loader": "^15.9.6",
5656
"vue-template-compiler": "^2.6.12",
57-
"webpack": "^5.31.2"
57+
"webpack": "^5.33.1"
5858
}
5959
}

Diff for: src/VdtnetTable.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,14 @@ export default {
493493
})
494494
}
495495
496+
$el.find('#vdtnetable1_wrapper').on('remove', () => {
497+
if (that.dataTable) {
498+
that.dataTable.destroy(true)
499+
}
500+
501+
that.dataTable = null
502+
})
503+
496504
// wire up edit, delete, and/or action buttons
497505
$el.on('click', '[data-action]', (e) => {
498506
e.preventDefault()
@@ -578,14 +586,6 @@ export default {
578586
that.reload()
579587
}
580588
},
581-
beforeDestroy() {
582-
const that = this
583-
if (that.dataTable) {
584-
that.dataTable.destroy(true)
585-
}
586-
587-
that.dataTable = null
588-
},
589589
methods: {
590590
/**
591591
* Vue.compile a template string and return the compiled function

0 commit comments

Comments
 (0)