mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
adjust column defs
This commit is contained in:
parent
cfc90adc9d
commit
025e75739d
3 changed files with 31 additions and 25 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
];
|
||||
|
|
@ -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")
|
||||
}
|
||||
];
|
||||
Loading…
Reference in a new issue