Merged in bugfix/PMCORE-3358 (pull request #8177)

PMCORE-3358

Approved-by: Rodrigo Quelca
This commit is contained in:
Fabio Guachalla
2021-09-27 21:00:34 +00:00
committed by Julio Cesar Laura Avendaño
7 changed files with 125 additions and 1 deletions

View File

@@ -1,7 +1,19 @@
<template> <template>
<i v-if="props.sortable" :class="icon"></i> <div>
<i v-if="props.sortable" :class="icon"></i>
<b-button
class="btn-clear-sort"
variant="primary"
@click="clear"
size="sm"
v-if="this.props.sortStatus.sorted"
>
{{ $t('ID_CLEAR') }}
</b-button>
</div>
</template> </template>
<script> <script>
import { Event } from "vue-tables-2";
export default { export default {
name: "VtSortControl", name: "VtSortControl",
props: ["props"], props: ["props"],
@@ -15,5 +27,15 @@ export default {
: "fas fa-sort-amount-down"; : "fas fa-sort-amount-down";
}, },
}, },
methods: {
/**
* Send the event to reset the sort
*/
clear (e) {
e.preventDefault();
Event.$emit("clearSortEvent");
e.stopPropagation();
}
}
}; };
</script> </script>

View File

@@ -678,6 +678,7 @@ export default {
id: that.data.customListId id: that.data.customListId
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function(val) { columns: function(val) {
@@ -1238,6 +1239,21 @@ export default {
return dataEllipsisMap[page]; return dataEllipsisMap[page];
} }
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false)
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: that.data.pageParent,
type: "custom",
id: that.data.customListId
});
}
}
}; };
</script> </script>
<style> <style>

View File

@@ -352,6 +352,7 @@ export default {
id: this.id id: this.id
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function (val) { columns: function (val) {
@@ -687,6 +688,21 @@ export default {
onPostNotes() { onPostNotes() {
this.$refs["vueTable"].getData(); this.$refs["vueTable"].getData();
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false);
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: "draft",
type: "normal",
id: this.id
});
}
}
}, },
}; };
</script> </script>

View File

@@ -387,6 +387,7 @@ export default {
id: this.id id: this.id
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function (val) { columns: function (val) {
@@ -789,6 +790,21 @@ export default {
onPostNotes() { onPostNotes() {
this.$refs["vueTable"].getData(); this.$refs["vueTable"].getData();
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false);
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: "inbox",
type: "normal",
id: this.id
});
}
}
}, },
}; };
</script> </script>

View File

@@ -220,6 +220,7 @@ export default {
PAUSED: this.$i18n.t("ID_PAUSED"), PAUSED: this.$i18n.t("ID_PAUSED"),
UNASSIGNED: this.$i18n.t("ID_UNASSIGNED"), UNASSIGNED: this.$i18n.t("ID_UNASSIGNED"),
}, },
clearSortState: this.settings && this.settings.orderBy && this.settings.orderBy.column,
}; };
}, },
mounted() { mounted() {
@@ -241,6 +242,7 @@ export default {
id: this.id id: this.id
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function (val) { columns: function (val) {
@@ -713,6 +715,21 @@ export default {
countDownChanged(dismissCountDown) { countDownChanged(dismissCountDown) {
this.dataAlert.dismissCountDown = dismissCountDown; this.dataAlert.dismissCountDown = dismissCountDown;
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false)
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: "MyCases",
type: "normal",
id: this.id
});
}
}
}, },
}; };
</script> </script>
@@ -723,4 +740,9 @@ export default {
padding-left: 50px; padding-left: 50px;
padding-right: 50px; padding-right: 50px;
} }
/*.btn-clear-sort {
position: fixed;
margin-top: 16px;
margin-left: -11px;
}*/
</style> </style>

View File

@@ -386,6 +386,7 @@ export default {
id: this.id id: this.id
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function (val) { columns: function (val) {
@@ -772,6 +773,21 @@ export default {
onPostNotes() { onPostNotes() {
this.$refs["vueTable"].getData(); this.$refs["vueTable"].getData();
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false);
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: "paused",
type: "normal",
id: this.id
});
}
}
}, },
}; };
</script> </script>

View File

@@ -377,6 +377,7 @@ export default {
id: this.id id: this.id
}); });
}); });
Event.$on('clearSortEvent', this.clearSort);
}, },
watch: { watch: {
columns: function (val) { columns: function (val) {
@@ -741,6 +742,21 @@ export default {
onPostNotes() { onPostNotes() {
this.$refs["vueTable"].getData(); this.$refs["vueTable"].getData();
}, },
/**
* Reset the sort in the table
*/
clearSort() {
if (this.$refs['vueTable']) {
this.$refs['vueTable'].setOrder(false);
this.$emit("updateSettings", {
data: [],
key: "orderBy",
page: "unassigned",
type: "normal",
id: this.id
});
}
}
}, },
}; };
</script> </script>