adjust column defs

This commit is contained in:
Collin M. Barrett 2019-08-04 18:56:20 -05:00
parent cfc90adc9d
commit 025e75739d
3 changed files with 31 additions and 25 deletions

View file

@ -1,7 +1,7 @@
import { Table } from 'antd';
import * as React from "react";
import { columnProps } from './columnProps';
import { List } from './List';
import { columns } from './columns';
interface State {
data: List[];
@ -34,7 +34,8 @@ export class AllListsTable extends React.Component<{}, State> {
return (
<Table
size="small"
columns={columns}
scroll={{ x: 1500 }}
columns={columnProps}
rowKey={record => record.id.toString()}
dataSource={this.state.data}
loading={this.state.loading}

View file

@ -0,0 +1,28 @@
import { ColumnProps } from "antd/lib/table";
import { List } from './List';
const nameof = <T>(name: Extract<keyof T, string>): string => name;
export const columnProps: ColumnProps<List>[] = [
{
title: 'Name',
dataIndex: nameof<List>("name"),
width: 200,
fixed: 'left'
},
{
title: 'Description',
dataIndex: nameof<List>("description"),
width: 400
},
{
title: 'Languages',
dataIndex: nameof<List>("languageIds"),
width: 400
},
{
title: 'Tags',
dataIndex: nameof<List>("tagIds"),
width: 400
}
];

View file

@ -1,23 +0,0 @@
import { ColumnProps } from "antd/lib/table";
import { List } from './List';
const nameof = <T>(name: Extract<keyof T, string>): string => name;
export const columns: ColumnProps<List>[] = [
{
title: 'Name',
dataIndex: nameof<List>("name")
},
{
title: 'Description',
dataIndex: nameof<List>("description")
},
{
title: 'Languages',
dataIndex: nameof<List>("languageIds")
},
{
title: 'Tags',
dataIndex: nameof<List>("tagIds")
}
];