Skip to content

Commit

Permalink
Merge branch 'fix-issue-122'
Browse files Browse the repository at this point in the history
  • Loading branch information
ratiw committed Nov 14, 2016
2 parents dce89e7 + 9ffb25b commit ad0fea3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
9 changes: 4 additions & 5 deletions dist/vue-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ exports.default = {
if (i === false) {
//this field is not in the sort array yet
this.sortOrder.push({
field: field.name,
field: field.sortField,
direction: 'asc'
});
} else {
Expand All @@ -763,15 +763,14 @@ exports.default = {

this.sortOrder.splice(1); //removes additional columns

if (this.sortOrder[0].field == field.name) {
if (this.sortOrder[0].field == field.sortField) {
// change sort direction
this.sortOrder[0].direction = this.sortOrder[0].direction == 'asc' ? 'desc' : 'asc';
} else {
// reset sort direction
this.sortOrder[0].direction = 'asc';
}
this.sortOrder[0].field = field.name;
this.sortOrder[0].sortField = field.sortField;
this.sortOrder[0].field = field.sortField;
}

this.currentPage = 1; // reset page index
Expand All @@ -789,7 +788,7 @@ exports.default = {
}

for (var i = 0; i < this.sortOrder.length; i++) {
if (this.sortOrder[i].field == field.name) {
if (this.sortOrder[i].field == field.sortField) {
return i;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuetable",
"version": "1.5.6",
"version": "1.5.7",
"description": "vue.js table component that will automatically request JSON data from server and display them nicely in HTML table with swap-able/extensible pagination component",
"main": "dist/vue-table.js",
"dependencies": {
Expand Down
17 changes: 8 additions & 9 deletions src/components/Vuetable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -534,16 +534,16 @@ export default {
var key = this.multiSortKey.toLowerCase() + 'Key'
if (this.multiSort && event[key]){ //adding column to multisort
if (this.multiSort && event[key]) { //adding column to multisort
var i = this.currentSortOrder(field);
if(i === false){ //this field is not in the sort array yet
if (i === false) { //this field is not in the sort array yet
this.sortOrder.push({
field: field.name,
field: field.sortField,
direction: 'asc'
});
} else { //this field is in the sort array, now we change its state
if(this.sortOrder[i].direction == 'asc'){
if (this.sortOrder[i].direction == 'asc'){
// switch direction
this.sortOrder[i].direction = 'desc'
} else {
Expand All @@ -561,15 +561,14 @@ export default {
this.sortOrder.splice(1); //removes additional columns
if (this.sortOrder[0].field == field.name) {
if (this.sortOrder[0].field == field.sortField) {
// change sort direction
this.sortOrder[0].direction = this.sortOrder[0].direction == 'asc' ? 'desc' : 'asc'
} else {
// reset sort direction
this.sortOrder[0].direction = 'asc'
}
this.sortOrder[0].field = field.name
this.sortOrder[0].sortField = field.sortField
this.sortOrder[0].field = field.sortField
}
Expand All @@ -587,8 +586,8 @@ export default {
return false
}
for(var i = 0; i<this.sortOrder.length; i++){
if(this.sortOrder[i].field == field.name){
for(var i = 0; i < this.sortOrder.length; i++){
if(this.sortOrder[i].field == field.sortField){
return i;
}
}
Expand Down

0 comments on commit ad0fea3

Please sign in to comment.