Skip to content

Commit

Permalink
Merge pull request ElemeFE#50 from coolzjy/master
Browse files Browse the repository at this point in the history
custom sorting method
  • Loading branch information
Leopoldthecoder authored Jun 27, 2016
2 parents 240e39f + 59c0954 commit 8aebcc2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"babel-plugin-transform-runtime": "^6.1.18",
"babel-preset-es2015": "^6.1.18",
"babel-preset-stage-1": "^6.5.0",
"babel-runtime": "^5.8.x",
"babel-runtime": "^6.0.0",
"chai": "^3.3.0",
"chai-as-promised": "^5.1.0",
"css-loader": "^0.21.0",
Expand Down
4 changes: 2 additions & 2 deletions src/data/grid-body.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
filters: {
orderBy(array, sortKey, reverse) {
if (!sortKey) {
if (!sortKey || this.$parent.sortingCustom) {
return array;
}
var order = (reverse && reverse < 0) ? -1 : 1;
Expand Down Expand Up @@ -164,4 +164,4 @@
}
}
};
</script>
</script>
3 changes: 1 addition & 2 deletions src/data/grid-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
minWidth: {},
htmlTemplate: {},
sortable: {
type: Boolean,
default: undefined
},
resizable: {
Expand Down Expand Up @@ -223,4 +222,4 @@
}
}
};
</script>
</script>
10 changes: 8 additions & 2 deletions src/data/grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@
this.sortingProperty = null;
}
this.sortingDirection = column.direction === 'descending' ? -1 : 1;
this.sortingCustom = column.sortable === 'custom';
// custom sorting event
this.sortingCustom && this.$emit('sort', column);
},
reRender() {
Expand Down Expand Up @@ -751,8 +756,9 @@
fixedBodyWidth: '',
sortingColumn: null,
sortingProperty: null,
sortingDirection: 1
sortingDirection: 1,
sortingCustom: false
};
}
};
</script>
</script>

0 comments on commit 8aebcc2

Please sign in to comment.