Permalink
Browse files

feat(footer): add footer

  • Loading branch information...
VMBindraban
VMBindraban committed Sep 27, 2016
1 parent 227c94b commit 82adc65134ecb8a9b0d86a9605fa9905164da6bd
Showing with 36 additions and 34 deletions.
  1. +35 −34 src/bootstrap/datatable.html
  2. +1 −0 src/datatable.js
@@ -29,49 +29,50 @@

<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<!-- Labels -->
<th click.delegate="doSort(columnLabel)" repeat.for="columnLabel of columnLabels">
<!-- Just show the label -->
<span if.bind="sortable === null || columnLabel.nested" t="${columnLabel.label}">${columnLabel.label}</span>
<tr>
<!-- Labels -->
<th click.delegate="doSort(columnLabel)" repeat.for="columnLabel of columnLabels">
<!-- Just show the label -->
<span if.bind="sortable === null || columnLabel.nested" t="${columnLabel.label}">${columnLabel.label}</span>

<!-- Show label and make it sortable (click) -->
<a if.bind="sortable !== null && !columnLabel.nested">
<span t="${columnLabel.label}">${columnLabel.label}</span>
<i class="fa fa-${criteria.sort[columnLabel.column] ? (criteria.sort[columnLabel.column] === 'desc' ? 'caret-down' : 'caret-up') : 'sort'}">
</i>
</a>
</th>
<!-- Show label and make it sortable (click) -->
<a if.bind="sortable !== null && !columnLabel.nested">
<span t="${columnLabel.label}">${columnLabel.label}</span>
<i class="fa fa-${criteria.sort[columnLabel.column] ? (criteria.sort[columnLabel.column] === 'desc' ? 'caret-down' : 'caret-up') : 'sort'}">
</i>
</a>
</th>

<!-- Actions -->
<th if.bind="destroy != null || edit != null || actions.length > 0" t="Actions">Actions</th>
</tr>
<!-- Actions -->
<th if.bind="destroy != null || edit != null || actions.length > 0" t="Actions">Actions</th>
</tr>
</thead>
<tbody>
<tr repeat.for="row of data">
<tr repeat.for="row of data">

<!-- Columns -->
<td repeat.for="columnLabel of columnLabels">
<a click.delegate="selected(row)">${displayValue(row, columnLabel.column) | convertManager: columnLabel.converter}</a>
</td>
<!-- Columns -->
<td repeat.for="columnLabel of columnLabels">
<a click.delegate="selected(row)">${displayValue(row, columnLabel.column) | convertManager: columnLabel.converter}</a>
</td>

<!-- Actions -->
<td style="white-space: nowrap; width: 1px;" if.bind="destroy !== null || edit !== null || actions.length > 0">
<button if.bind="edit !== null" class="btn btn-sm btn-white" click.delegate="doEdit(row)">
<i class="fa fa-pencil"></i>
</button>
<!-- Actions -->
<td style="white-space: nowrap; width: 1px;" if.bind="destroy !== null || edit !== null || actions.length > 0">
<button if.bind="edit !== null" class="btn btn-sm btn-white" click.delegate="doEdit(row)">
<i class="fa fa-pencil"></i>
</button>

<button if.bind="destroy !== null" class="btn btn-sm btn-danger" click.delegate="doDestroy(row)">
<i class="fa fa-trash"></i>
</button>
<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" t="[title]${action.title}" title.bind="action.title || ''" disabled.bind="checkDisabled(action, row)" class="btn btn-sm btn-${action.type || 'default'}" click.trigger="doCustomAction(action, row)">
<i if.bind="action.icon" class="fa fa-${action.icon}"></i>
<span if.bind="!action.icon && action.title" t="${action.title}">${action.title}</span>
</button>
</td>
</tr>
<button repeat.for="action of actions" t="[title]${action.title}" title.bind="action.title || ''" disabled.bind="checkDisabled(action, row)" class="btn btn-sm btn-${action.type || 'default'}" click.trigger="doCustomAction(action, row)">
<i if.bind="action.icon" class="fa fa-${action.icon}"></i>
<span if.bind="!action.icon && action.title" t="${action.title}">${action.title}</span>
</button>
</td>
</tr>
</tbody>
<tfoot if.bind="footer" innerhtml.bind="footer"></tfoot>
</table>

<div show.bind="pages > 1">
@@ -32,6 +32,7 @@ export class DataTable {
@bindable data;
@bindable route;
@bindable pages;
@bindable footer;

constructor(router, element, entityManager) {
this.router = router;

0 comments on commit 82adc65

Please sign in to comment.