Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions frameworks/keyed/ember/app/components/my-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,11 @@ export default class MyTable extends Component {
}

@action remove(id) {
const selected = this.data.find(({selected}) => selected === true);
if (selected) {
selected.selected = false;
}
this.data = deleteRow(this.data, id);
this.selected = undefined;
}

@action select(id) {
this.selected = id;
const selected = this.data.find(({selected}) => selected === true);
if (selected) {
selected.selected = false;
}
this.data.find((item)=>item.id === id).selected = true;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- template-lint-disable --}}
<tr class={{if @item.selected "danger"}}>
<tr ...attributes>
<td class="col-md-1">{{@item.id}}</td>
<td class="col-md-4"><a {{on 'click' @onSelect}}>{{@item.label}}</a></td>
<td class="col-md-1"><a {{on 'click' @onRemove}}><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></a></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

{{#if this.data.length}}
<FastEach class="table table-hover table-striped test-data" @items={{this.data}} as |item|>
<TableRow @item={{item}} @onSelect={{fn this.select item.id}} @onRemove={{fn this.remove item.id}} />
<TableRow class={{if (eq this.selected item.id) 'danger'}} @item={{item}} @onSelect={{fn this.select item.id}} @onRemove={{fn this.remove item.id}} />
</FastEach>
{{/if}}

Expand Down
5 changes: 1 addition & 4 deletions frameworks/keyed/ember/app/utils/benchmark-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { tracked } from '@glimmer/tracking';

class TodoItem {
@tracked label;
@tracked selected;
@tracked id
constructor({label,selected, id}) {
constructor({label, id}) {
this.label = label;
this.selected = selected;
this.id = id;
}
}
Expand Down Expand Up @@ -43,7 +41,6 @@ export const buildData = (id, count = 1000) => {
for (var i = 0; i < count; i++)
data.push(new TodoItem({
id: id++,
selected: false,
label: adjectives[_random(adjectives.length)]
+ " "
+ colours[_random(colours.length)]
Expand Down