Skip to content

Commit

Permalink
Fix #255
Browse files Browse the repository at this point in the history
  • Loading branch information
amcdnl committed Nov 9, 2016
1 parent a07d2f7 commit b3aef37
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
9 changes: 8 additions & 1 deletion demo/basic/inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ import { Component } from '@angular/core';
selector: 'inline-edit-demo',
template: `
<div>
<h3>Inline Editing</h3>
<h3>
Inline Editing
<small>
<a href="#" (click)="mydatatable.refresh()">Refresh</a>
</small>
</h3>
<datatable
#mydatatable
class="material"
[headerHeight]="50"
[limit]="5"
[columnMode]="'force'"
[footerHeight]="50"
[rowHeight]="'auto'"
Expand Down
7 changes: 3 additions & 4 deletions demo/basic/row-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import { Component, ViewEncapsulation, ViewChild } from '@angular/core';
<div>
<h3>
Row Detail Demo
<br />
<small style="position:absolute;right:20px;top:5px;">
<button (click)="mydatatable.expandAllRows()">Expand All</button>
<button (click)="mydatatable.collapseAllRows()">Collapse All</button>
<small>
<a href="#" (click)="mydatatable.expandAllRows()">Expand All</a> |
<a href="#" (click)="mydatatable.collapseAllRows()">Collapse All</a>
</small>
</h3>
<datatable
Expand Down
11 changes: 11 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
color: #FFF;
text-align: left;
padding: 10px;
overflow: hidden;
height: 32px;
}

h3 a {
color: #ccc;
}

h3 small {
margin-left: 10px;
font-size: .8rem;
}

.fullscreen {
Expand Down
1 change: 1 addition & 0 deletions docs/api/table-fns.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* `expandAllRows()`: Expand all row details when using row detail templates.
* `collapseAllRows()`: Collapse all row details when using row detail templates.
* `recalculate()`: Recalculate the grid sizes.
* `refresh()`: Refresh rows in the grid.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.4.0
- Enhancement: Added `refresh` API for updating table (#255)
- Bug: Fix intersection observer type errors (#268)

## 1.3.1
- Bug: Fix force column width distribution overriding new resize (#245)

Expand Down
7 changes: 7 additions & 0 deletions src/components/datatable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ export class DatatableComponent implements OnInit, AfterViewInit {
this.recalculate();
}

/**
* Refresh the table rows manually.
*/
refresh(): void {
this.bodyComponent.recalcLayout();
}

/**
* Toggle the expansion of the row
*
Expand Down

0 comments on commit b3aef37

Please sign in to comment.