Refactor on DataTable

pull/14/head
mertsincan 2019-07-02 12:02:55 +03:00
parent ff20a00e8f
commit 3ce0a109d2
1 changed files with 8 additions and 2 deletions

View File

@ -162,7 +162,7 @@ export default {
}, },
data() { data() {
return { return {
columns: [], allChildren: null,
d_first: this.first, d_first: this.first,
d_rows: this.rows, d_rows: this.rows,
d_sortField: this.sortField, d_sortField: this.sortField,
@ -184,7 +184,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.columns = this.$children.filter(child => child.$options._propKeys.indexOf('columnKey') !== -1); this.allChildren = this.$children;
}, },
methods: { methods: {
getRowKey(rowData, index) { getRowKey(rowData, index) {
@ -264,6 +264,12 @@ export default {
} }
}, },
computed: { computed: {
columns() {
if (this.allChildren) {
return this.allChildren.filter(child => child.$options._propKeys.indexOf('columnKey') !== -1);
}
return [];
},
data() { data() {
if (this.value && this.value.length) { if (this.value && this.value.length) {
let data = this.value; let data = this.value;