feat(smartTag): added sort priority between multiple sorting #853
|
@ -246,7 +246,7 @@ export default class SmartTable extends Component {
|
|||
if (!existingCriteria) {
|
||||
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.add('asc');
|
||||
|
||||
|
|
|
@ -116,9 +116,10 @@ describe('Component smartTable', () => {
|
|||
expect(firstSortCriteria.field).toEqual('test1');
|
||||
expect(firstSortCriteria.sortType).toEqual('ASC');
|
||||
expect(firstSortCriteria.priority).toEqual(1);
|
||||
|
||||
expect(secondSortCriteria.field).toEqual('id');
|
||||
expect(secondSortCriteria.sortType).toEqual('DESC');
|
||||
expect(firstSortCriteria.priority).toEqual(2);
|
||||
expect(secondSortCriteria.priority).toEqual(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue