Skip to content

Methods

Robert Hjalmers edited this page Jan 9, 2018 · 5 revisions

Available methods

Name Description Usage
exportCSV See Export to CSV section myTable.exportCSV('custom-file-name', true)
gtApplyFilter Filter table data, see example myTable.gtApplyFilter(object with filters)
gtClearFilter Clear filters, see example myTable.gtClearFilter()
gtSearch See Global table search and highlight section myTable.gtSearch(search string)
changeRowLength Change number of visible rows, see example myTable.changeRowLength(20)
nextPage Go to next page myTable.nextPage()
previousPage Go to previous myTable.previousPage()
goToPage Go to specific page (pass page number) myTable.goToPage(1)
selectAllRows Select all rows myTable.selectAllRows()
deselectAllRows Deselect all rows myTable.deselectAllRows()
isRowSelected Check if row is selected myTable.isRowSelected(row)
expandAllRows Expand all rows myTable.expandAllRows()
collapseAllRows Collapse all rows myTable.collapseAllRows()
inlineEditUpdate Update rows with pending inline edits, see example myTable.inlineEditUpdate()
inlineEditCancel Cancel and reset pending inline edits, see example myTable.inlineEditCancel()
hasEdits Check if table has pending inline edits, see example myTable.hasEdits()
removeRow Remove/delete row from table myTable.removeRow(row)
gtAdd Add one or more records/rows to table (pass an array of rows to add), returns new data array, see example myTable.gtAdd([row object])
gtDelete Delete one or more records/rows from the table (pass object key, value to match, match all/first), returns new data array, see example myTable.gtDelete('id','a1')

Usage

In template

<button (click)="myTable.exportCSV()">Export to CSV</button>
<generic-table #myTable ...></generic-table>

In component

  @ViewChild(GenericTableComponent)
  private myTable: GenericTableComponent<any, CustomRowComponent>;
  
  public exportToCSV= function(){
    this.myTable.exportCSV();
  };