<!DOCTYPE html>
<html>

  <head>
    <title>angular2 playground</title>
     <link rel="stylesheet" type="text/css" href="https://unpkg.com/angular2-data-table/release/datatable.css" />
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/angular2-data-table/release/material.css" />
    <link href="https://file.myfontastic.com/Jnf54BZCm7mSjGCxNRbfp3/icons.css" rel="stylesheet">
    <link rel="stylesheet" href="style.css" />
    
    <script src="https://unpkg.com/zone.js@0.6.23/dist/zone.js"></script>
    <script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script>
    <script src="https://unpkg.com/systemjs@0.19.31/dist/system.js"></script>
    <script src="https://unpkg.com/typescript@1.8.10/lib/typescript.js"></script>
    <script src="config.js"></script>
    <script>
    System.import('app')
      .catch(console.error.bind(console));
  </script>
  </head>

  <body>
    <my-app>
    loading...
  </my-app>
  </body>

</html>
body {
  font-family: 'RobotoDraft', 'Roboto', 'Helvetica Neue, Helvetica, Arial', sans-serif;
  text-align: center;
  font-style: normal;
  font-weight: 300;
  font-size: 1.4rem;
  line-height: 2rem;
  letter-spacing: 0.01rem;
  color: #212121;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  margin: 20px
}

.datatable {
  text-align: left;
  width: 75%;
  margin: 0 auto;
}

.datatable.vertical-scroll {
  height: 70vh;
}

.sortable .sort-btn:after {
  font-family: data-table;
  content: "c";
}

.sortable .sort-btn.datatable-icon-down:after {
  content: "f";
}

.sortable .sort-btn.datatable-icon-up:after {
  content: "e";
}r {
  content: "e";
}
# angular2-data-table basic example
System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  //map tells the System loader where to look for things
  map: {
    app: "./src",
    '@angular': 'https://unpkg.com/@angular',
    'rxjs': 'https://unpkg.com/rxjs@5.0.0-beta.12',
    '@swimlane/ngx-datatable': 'https://unpkg.com/@swimlane/ngx-datatable'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './bootstrap.ts',
      defaultExtension: 'ts'
    },
    '@angular/core': {
      main: 'bundles/core.umd.js',
      defaultExtension: 'js'
    },
    '@angular/compiler': {
      main: 'bundles/compiler.umd.js',
      defaultExtension: 'js'
    },
    '@angular/common': {
      main: 'bundles/common.umd.js',
      defaultExtension: 'js'
    },
    '@angular/platform-browser-dynamic': {
      main: 'bundles/platform-browser-dynamic.umd.js',
      defaultExtension: 'js'
    },
    '@angular/platform-browser': {
      main: 'bundles/platform-browser.umd.js',
      defaultExtension: 'js'
    },
    '@angular/forms': {
      main: 'index.js',
      defaultExtension: 'js'
    },
    '@angular/router': {
      main: 'index.js',
      defaultExtension: 'js'
    },
    rxjs: {
      defaultExtension: 'js'
    }
  }
});
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';

platformBrowserDynamic().bootstrapModule(AppModule)
//our root app component
import {Component, NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import { NgxDatatableModule } from '@swimlane/ngx-datatable';

import {
  TableOptions,
  TableColumn,
  ColumnMode
} from '@swimlane/ngx-datatable';

@Component({
  selector: 'my-app',
  template: `
    <div>
      <h3>basic</h3>
      <ngx-datatable
        class='material striped'
        [rows]='rows'
        [columns]='[{name:"Name"},{name:"Gender"},{name:"Company", sortable: false}]'
        [columnMode]='"force"'
        [headerHeight]='50'
        [footerHeight]='50'
        [rowHeight]='"auto"'>
      </ngx-datatable>
    </div>
  `
})
export class App {

  rows = [];

  constructor() {
    this.fetch((data) => {
      this.rows.push(...data);
    });
  }

  fetch(cb) {
    const req = new XMLHttpRequest();
    req.open('GET', 'https://unpkg.com/@swimlane/ngx-datatable@6.3.0/assets/data/company.json');

    req.onload = () => {
      cb(JSON.parse(req.response));
    };

    req.send();
  }

}


@NgModule({
  imports: [ BrowserModule, NgxDatatableModule ],
  declarations: [ App ],
  bootstrap: [ App ]
})
export class AppModule {}