Skip to content

chore: add md-table to universal app #6356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/universal-app/kitchen-sink/kitchen-sink.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,24 @@ <h2>Expansion Panel</h2>

<h2>CDK Table</h2>

<cdk-table #table [dataSource]="cdkTableDataSource">
<cdk-table #table [dataSource]="tableDataSource">
<ng-container cdkColumnDef="userId">
<cdk-header-cell *cdkHeaderCellDef>ID</cdk-header-cell>
<cdk-cell *cdkCellDef="let row">{{row.userId}}</cdk-cell>
</ng-container>

<cdk-header-row *cdkHeaderRowDef="cdkTableColumns" ></cdk-header-row>
<cdk-row *cdkRowDef="let row; columns: cdkTableColumns;"></cdk-row>
<cdk-header-row *cdkHeaderRowDef="tableColumns" ></cdk-header-row>
<cdk-row *cdkRowDef="let row; columns: tableColumns;"></cdk-row>
</cdk-table>

<h2>Material Table</h2>

<md-table [dataSource]="tableDataSource">
<ng-container cdkColumnDef="userId">
<md-header-cell *cdkHeaderCellDef>ID</md-header-cell>
<md-cell *cdkCellDef="let row"> {{row.userId}} </md-cell>
</ng-container>

<md-header-row *cdkHeaderRowDef="tableColumns"></md-header-row>
<md-row *cdkRowDef="let row; columns: tableColumns;"></md-row>
</md-table>
10 changes: 6 additions & 4 deletions src/universal-app/kitchen-sink/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
MdSlideToggleModule,
MdSnackBarModule,
MdSortModule,
MdTableModule,
MdTabsModule,
MdToolbarModule,
MdTooltipModule,
Expand All @@ -45,11 +46,11 @@ import 'rxjs/add/observable/of';
})
export class KitchenSink {

/** List of columns for the CDK table. */
cdkTableColumns = ['userId'];
/** List of columns for the CDK and Material table. */
tableColumns = ['userId'];

/** Data source for the CDK table. */
cdkTableDataSource: DataSource<any> = {
/** Data source for the CDK and Material table. */
tableDataSource: DataSource<any> = {
connect: () => Observable.of([
{ userId: 1 },
{ userId: 2 }
Expand Down Expand Up @@ -93,6 +94,7 @@ export class KitchenSink {
MdTooltipModule,
MdExpansionModule,
MdSortModule,
MdTableModule,

// CDK Modules
CdkTableModule
Expand Down