deleteAll uses checkedRows getter now
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-10-26 09:18:31 +02:00
parent bf386929d3
commit e4fe125627
1 changed files with 7 additions and 4 deletions

View File

@ -60,20 +60,23 @@ export default class SmartTable extends Component {
return criteria.field == field;
});
const isASC = existingCriteria && existingCriteria.sortType == 'ASC';
const isDESC = existingCriteria && existingCriteria.sortType == 'DESC';
if (!existingCriteria) {
this.sortCriteria.push({field: field, sortType: 'ASC'});
element.classList.remove('desc');
element.classList.add('asc');
}
if (existingCriteria && existingCriteria.sortType == 'DESC') {
if (isDESC) {
this.sortCriteria.splice(this.sortCriteria.findIndex(criteria => {
return criteria.field == field;
}), 1);
element.classList.remove('desc');
element.classList.remove('asc');
}
if (existingCriteria && existingCriteria.sortType == 'ASC') {
if (isASC) {
existingCriteria.sortType = 'DESC';
element.classList.remove('asc');
element.classList.add('desc');
@ -99,8 +102,8 @@ export default class SmartTable extends Component {
}
deleteAll() {
const rowsChecked = this.checkedRows();
for (let row of rowsChecked)
const checkedRows = this.checkedRows;
for (let row of checkedRows)
this.model.removeRow(row);
if (this.autoSave)