option_sortable prop is activated
This commit is contained in:
parent
82c98b5f2a
commit
f5aa1c9acd
@ -345,55 +345,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
sortOptions() {
|
sortOptions() {
|
||||||
if (this.group) {
|
if (this.group) {
|
||||||
this.sort_options.sort(function (a, b) {
|
this.sort_options.sort(this.sortBy("key"));
|
||||||
var nameA = a.key.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameB = b.key.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameA < nameB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameA > nameB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const [index, options] of Object.entries(this.sort_options)) {
|
for (const [index, options] of Object.entries(this.sort_options)) {
|
||||||
options.value.sort(function (aa, bb) {
|
options.value.sort(this.sortBy(this.option_sortable));
|
||||||
var nameAA = aa.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameBB = bb.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameAA < nameBB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameAA > nameBB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.sort_options.sort(function (a, b) {
|
this.sort_options.sort(this.sortBy(this.option_sortable));
|
||||||
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameA < nameB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameA > nameB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.sort_options;
|
return this.sort_options;
|
||||||
@ -424,6 +382,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
sortBy(option) {
|
||||||
|
return (a, b) => {
|
||||||
|
var nameA = a.[option].toUpperCase(); // ignore upper and lowercase
|
||||||
|
var nameB = b.[option].toUpperCase(); // ignore upper and lowercase
|
||||||
|
|
||||||
|
if (nameA < nameB) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameA > nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// names must be equal
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
change() {
|
change() {
|
||||||
// This controll added add new changed..
|
// This controll added add new changed..
|
||||||
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
|
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
|
||||||
|
@ -412,55 +412,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
sortOptions() {
|
sortOptions() {
|
||||||
if (this.group) {
|
if (this.group) {
|
||||||
this.sort_options.sort(function (a, b) {
|
this.sort_options.sort(this.sortBy("key"));
|
||||||
var nameA = a.key.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameB = b.key.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameA < nameB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameA > nameB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const [index, options] of Object.entries(this.sort_options)) {
|
for (const [index, options] of Object.entries(this.sort_options)) {
|
||||||
options.value.sort(function (aa, bb) {
|
options.value.sort(this.sortBy(this.option_sortable));
|
||||||
var nameAA = aa.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameBB = bb.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameAA < nameBB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameAA > nameBB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.sort_options.sort(function (a, b) {
|
this.sort_options.sort(this.sortBy(this.option_sortable));
|
||||||
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
|
|
||||||
|
|
||||||
if (nameA < nameB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameA > nameB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// names must be equal
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.sort_options;
|
return this.sort_options;
|
||||||
@ -491,6 +449,23 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
sortBy(option) {
|
||||||
|
return (a, b) => {
|
||||||
|
var nameA = a.[option].toUpperCase(); // ignore upper and lowercase
|
||||||
|
var nameB = b.[option].toUpperCase(); // ignore upper and lowercase
|
||||||
|
|
||||||
|
if (nameA < nameB) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameA > nameB) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// names must be equal
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
setSortOptions() {
|
setSortOptions() {
|
||||||
if (this.group) {
|
if (this.group) {
|
||||||
// Option set sort_option data
|
// Option set sort_option data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user