Skip to content

Commit a783450

Browse files
committed
Merge branch 'noru-master'
2 parents f55f724 + 5a9a43b commit a783450

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

dist/vue-table.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,9 @@ exports.default = {
632632

633633
var url = this.apiUrl + '?' + this.getAllQueryParams();
634634
this.$http.get(url, this.httpOptions).then(function (response) {
635-
self.tableData = self.getObjectValue(response.body, self.dataPath, null);
636-
self.tablePagination = self.getObjectValue(response.body, self.paginationPath, null);
635+
var body = this.transform(response.body);
636+
self.tableData = self.getObjectValue(body, self.dataPath, null);
637+
self.tablePagination = self.getObjectValue(body, self.paginationPath, null);
637638
if (self.tablePagination === null) {
638639
console.warn('vuetable: pagination-path "' + self.paginationPath + '" not found. ' + 'It looks like the data returned from the sever does not have pagination information ' + 'or you may have set it incorrectly.');
639640
}
@@ -672,6 +673,18 @@ exports.default = {
672673
}
673674
this.dispatchEvent('loaded');
674675
},
676+
transform: function transform(data) {
677+
var func = 'transform';
678+
679+
if (this.parentFunctionExists(func)) {
680+
return this.$parent[func].call(this.$parent, data);
681+
}
682+
683+
return data;
684+
},
685+
parentFunctionExists: function parentFunctionExists(func) {
686+
return func !== '' && typeof this.$parent[func] === 'function';
687+
},
675688
getTitle: function getTitle(field) {
676689
if (typeof field.title === 'undefined') {
677690
return field.name.replace('.', ' ');

0 commit comments

Comments
 (0)