adopted-ember-addons / adopted-ember-addons/ember-light-table

Examples don't set sort direction in initial sort column setup.

Đang mở
#491 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
311
Fork
130
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

In the demos table-common.js init method you set the initially sorted column, but not the direction. If you change default direction on the component to 'desc' you have to click on sort twice to get an ascending sorting. Because the `ascending` property on the column defaults to true.

Adding this to the init method fixes it, but don't know if it that's how it meant to be set.

```diff
init() {
this._super(...arguments);

let table = new Table(this.get('columns'), this.get('model'), { enableSync: this.get('enableSync') });
let sortColumn = table.get('allColumns').findBy('valuePath', this.get('sort'));

// Setup initial sort column
if (sortColumn) {
sortColumn.set('sorted', true);
+ sortColumn.set('ascending', this.get('dir') === 'asc' ? true : false)
}

this.set('table', table);
},
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.