diff --git a/front/core/components/smart-table/index.js b/front/core/components/smart-table/index.js
index 530d2fd15..036552086 100644
--- a/front/core/components/smart-table/index.js
+++ b/front/core/components/smart-table/index.js
@@ -12,7 +12,7 @@ export default class SmartTable extends Component {
this.currentUserId = window.localStorage.currentUserWorkerId;
this.$transclude = $transclude;
this.sortCriteria = [];
- this.$inputScopes = [];
+ this.$inputsScope;
this.columns = [];
this.autoSave = false;
this.transclude();
@@ -118,29 +118,11 @@ export default class SmartTable extends Component {
transclude() {
const slotTable = this.element.querySelector('#table');
- this.$transclude(($clone, $scope) => {
+ this.$transclude($clone => {
const table = $clone[0];
slotTable.appendChild(table);
this.registerColumns();
-
- const header = this.element.querySelector('thead > tr');
- const columns = header.querySelectorAll('th');
- const tbody = this.element.querySelector('tbody');
- if (tbody) {
- const noSearch = this.$compile(`
-
- Enter a new search |
-
- `)($scope);
- tbody.appendChild(noSearch[0]);
-
- const noRows = this.$compile(`
-
- No data |
-
- `)($scope);
- tbody.appendChild(noRows[0]);
- }
+ this.emptyDataRows();
}, null, 'table');
}
@@ -150,7 +132,8 @@ export default class SmartTable extends Component {
viewConfig.configuration = Object.assign({}, viewConfig.configuration);
userViewModel.save()
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
- .then(() => this.applyViewConfig());
+ .then(() => this.applyViewConfig())
+ .then(() => this.$.smartTableColumns.hide());
}
applyViewConfig() {
@@ -199,6 +182,27 @@ export default class SmartTable extends Component {
}
}
+ emptyDataRows() {
+ const header = this.element.querySelector('thead > tr');
+ const columns = header.querySelectorAll('th');
+ const tbody = this.element.querySelector('tbody');
+ if (tbody) {
+ const noSearch = this.$compile(`
+
+ Enter a new search |
+
+ `)(this.$);
+ tbody.appendChild(noSearch[0]);
+
+ const noRows = this.$compile(`
+
+ No data |
+
+ `)(this.$);
+ tbody.appendChild(noRows[0]);
+ }
+ }
+
orderHandler(element) {
const field = element.getAttribute('field');
const existingCriteria = this.sortCriteria.find(criteria => {
@@ -240,15 +244,17 @@ export default class SmartTable extends Component {
const hasSearchRow = tbody.querySelector('tr#searchRow');
if (hasSearchRow) {
- if (this.$inputScopes) {
- for (let $inputScope of this.$inputScopes)
- $inputScope.$destroy();
- }
+ if (this.$inputsScope)
+ this.$inputsScope.$destroy();
+
return hasSearchRow.remove();
}
const searchRow = document.createElement('tr');
searchRow.setAttribute('id', 'searchRow');
+
+ this.$inputsScope = this.$.$new();
+
for (let column of columns) {
const field = column.getAttribute('field');
const cell = document.createElement('td');
@@ -265,7 +271,6 @@ export default class SmartTable extends Component {
continue;
}
- const $inputScope = this.$.$new();
if (options && options.autocomplete) {
let props = ``;
@@ -280,7 +285,7 @@ export default class SmartTable extends Component {
${props}
on-change="$ctrl.searchByColumn('${field}')"
clear-disabled="true"
- />`)($inputScope);
+ />`)(this.$inputsScope);
} else {
input = this.$compile(`
`)($inputScope);
+ />`)(this.$inputsScope);
}
- this.$inputScopes.push($inputScope);
cell.appendChild(input[0]);
}
searchRow.appendChild(cell);
@@ -307,7 +311,7 @@ export default class SmartTable extends Component {
}
searchByColumn(field) {
- const searchCriteria = this.$.searchProps[field];
+ const searchCriteria = this.$inputsScope.searchProps[field];
const emptySearch = searchCriteria == '' || null;
const filters = this.filterSanitizer(field);
@@ -316,7 +320,7 @@ export default class SmartTable extends Component {
this.model.userFilter = filters.userFilter;
if (!emptySearch)
- this.addFilter(field, this.$.searchProps[field]);
+ this.addFilter(field, this.$inputsScope.searchProps[field]);
else this.model.refresh();
}
diff --git a/front/core/components/smart-table/table.scss b/front/core/components/smart-table/table.scss
index d3b9fa990..b5dc631a3 100644
--- a/front/core/components/smart-table/table.scss
+++ b/front/core/components/smart-table/table.scss
@@ -32,8 +32,12 @@ smart-table table {
text-overflow: ellipsis;
&[number] {
+ flex-direction: column;
text-align: right;
- width: 96px;
+ align-items:flex-end;
+ align-content: flex-end;
+
+ justify-content: right;
}
&[centered] {
text-align: center;
diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html
index a416db00b..25bff0d56 100644
--- a/modules/entry/front/latest-buys/index.html
+++ b/modules/entry/front/latest-buys/index.html
@@ -137,7 +137,7 @@
- {{::buy.itemFk | zeroFill:6}}
+ {{::buy.itemFk}}
|