import { Component } from '@angular/core' ; import { DataTableResource } from '../data-table' ; import persons from './data-table-demo1-data' ; @ Component ( { selector : 'data-table-demo-1' , providers : [ ] , templateUrl : './data-table-demo1.html' , styleUrls : [ './data-table-demo1.css' ] } ) export class DataTableDemo1 { itemResource = new DataTableResource ( persons ) ; items = [ ] ; itemCount = 0 ; constructor ( ) { this . itemResource . count ( ) . then ( count => this . itemCount = count ) ; } reloadItems ( params ) { this . itemResource . query ( params ) . then ( items => this . items = items ) ; } rowClick ( rowEvent ) { console . log ( 'Clicked: ' + rowEvent . row . item . name ) ; } rowDoubleClick ( rowEvent ) { alert ( 'Double clicked: ' + rowEvent . row . item . name ) ; } rowTooltip ( item ) { return item . jobTitle ; } }