JSXColumnsSmiple.jsx 1.5 KB

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