Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
feat(project): handle custom actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyvergnas committed Jun 27, 2016
1 parent 340a5ec commit 630fad9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/bootstrap/datatable.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
<button if.bind="destroy !== null" class="btn btn-sm btn-danger" click.delegate="doDestroy(row)">
<i class="fa fa-trash"></i>
</button>

<button repeat.for="action of actions" class="btn btn-sm btn-${action.type || 'white'}" click.delegate="action.action(row)">
<i class="fa fa-${action.icon}"></i>
</button>
</td>
</tr>
</tbody>
Expand Down
9 changes: 5 additions & 4 deletions src/datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class DataTable {
@bindable data;
@bindable route;
@bindable pages;
bindable actions;

constructor(Router, element, entityManager) {
this.router = Router;
Expand Down Expand Up @@ -115,8 +116,8 @@ export class DataTable {
searchColumnChanged(newValue, oldValue) {
if (!this.ready) {
return;
}
}

delete this.criteria.where[oldValue];

return this.doSearch();
Expand All @@ -125,8 +126,8 @@ export class DataTable {
doSearch() {
if (!this.ready) {
return;
}
}

if (typeof this.criteria.where[this.searchColumn] === 'object') {
this.criteria.where[this.searchColumn].contains = this.search;
} else {
Expand Down

0 comments on commit 630fad9

Please sign in to comment.