JSXColumnPropColumn.jsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from 'react';
  2. import Table from '../';
  3. export default class App extends React.Component {
  4. constructor(props) {
  5. super(props);
  6. this.columns = [
  7. {
  8. title: 'Name',
  9. dataIndex: 'name',
  10. render: (text, record, index) => (<a>{text}</a>),
  11. },
  12. {
  13. title: 'Age',
  14. dataIndex: 'age',
  15. },
  16. {
  17. title: 'Address',
  18. dataIndex: 'address',
  19. },
  20. ];
  21. this.data = [
  22. {
  23. key: '1',
  24. name: 'John Brown',
  25. age: 32,
  26. address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
  27. },
  28. {
  29. key: '2',
  30. name: 'Jim Green',
  31. age: 42,
  32. address: 'London No. 1 Lake Park',
  33. },
  34. {
  35. key: '3',
  36. name: 'Joe Black',
  37. age: 32,
  38. address: 'Sidney No. 1 Lake Park',
  39. },
  40. {
  41. key: '4',
  42. name: 'Michael James',
  43. age: 99,
  44. address: 'Sidney No. 1 Lake Park',
  45. },
  46. ];
  47. }
  48. render() {
  49. return (
  50. <Table columns={this.columns} dataSource={this.data} pagination={false}>
  51. <Table.Column title="Age" dataIndex="age" key="age" />
  52. </Table>
  53. );
  54. }
  55. }