feat(smartTag): added sort priority between multiple sorting #853

Merged
carlosjr merged 3 commits from 3528-smartTable_sort_priority into dev 2022-01-20 09:47:32 +00:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit 7a5e7b4c20 - Show all commits

View File

@ -246,7 +246,7 @@ export default class SmartTable extends Component {
if (!existingCriteria) { if (!existingCriteria) {
const priority = this.sortCriteria.length + 1; const priority = this.sortCriteria.length + 1;
this.sortCriteria.push({field: field, sortType: 'ASC', priority: 1}); this.sortCriteria.push({field: field, sortType: 'ASC', priority: priority});
element.classList.remove('desc'); element.classList.remove('desc');
element.classList.add('asc'); element.classList.add('asc');

View File

@ -116,9 +116,10 @@ describe('Component smartTable', () => {
expect(firstSortCriteria.field).toEqual('test1'); expect(firstSortCriteria.field).toEqual('test1');
expect(firstSortCriteria.sortType).toEqual('ASC'); expect(firstSortCriteria.sortType).toEqual('ASC');
expect(firstSortCriteria.priority).toEqual(1); expect(firstSortCriteria.priority).toEqual(1);
expect(secondSortCriteria.field).toEqual('id'); expect(secondSortCriteria.field).toEqual('id');
expect(secondSortCriteria.sortType).toEqual('DESC'); expect(secondSortCriteria.sortType).toEqual('DESC');
expect(firstSortCriteria.priority).toEqual(2); expect(secondSortCriteria.priority).toEqual(2);
}); });
}); });