Created
January 7, 2019 09:40
-
-
Save PTKC/510616da1fb43046214caf89cdd3463c to your computer and use it in GitHub Desktop.
Ant Design Table with Ant Motion example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Input, Table } from "antd"; | |
import QueueAnim from "rc-queue-anim"; | |
import React from "react"; | |
const TextArea = Input.TextArea; | |
const AnimationWrapper = ({ ...props }) => <QueueAnim duration={1000} component="tbody" {...props} />; | |
const DataSource = [ | |
{ | |
id: "content-1", | |
content: "Hello World 1" | |
}, | |
{ | |
id: "content-2", | |
content: "Hello World 2" | |
}, | |
{ | |
id: "content-2", | |
content: "Hello World 3" | |
} | |
]; | |
const Columns = [ | |
{ | |
dataIndex: "id", | |
key: "id", | |
render: (text: string, record: any, index: number): any => { | |
return { | |
children: text | |
}; | |
}, | |
title: <div>Id</div> | |
}, | |
{ | |
dataIndex: "content", | |
key: "content", | |
render: (text: string, record: any, index: number): any => { | |
return { | |
children: text | |
}; | |
}, | |
title: <div>Content</div> | |
} | |
]; | |
interface Props {} | |
interface State {} | |
export class TableExample extends React.Component<Props, State> { | |
constructor(props: Props) { | |
super(props); | |
} | |
public render(): JSX.Element { | |
return ( | |
<Table | |
bordered={false} | |
columns={Columns} | |
components={{ | |
body: { | |
wrapper: AnimationWrapper | |
} | |
}} | |
dataSource={DataSource} | |
locale={{ emptyText: "No Content" }} | |
pagination={false} | |
size="small" | |
/> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment