From 806e4847129f2c88a9241cd39692a27e6bdeefc2 Mon Sep 17 00:00:00 2001 From: "@soyjavi" Date: Wed, 4 Nov 2015 10:15:27 +0700 Subject: [PATCH] Documentation for --- components/table/readme.md | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 components/table/readme.md diff --git a/components/table/readme.md b/components/table/readme.md new file mode 100644 index 00000000..00573f33 --- /dev/null +++ b/components/table/readme.md @@ -0,0 +1,49 @@ +# Table + +The Table component is an enhanced version of the standard HTML `
`. A data-table consists of rows and columns of well-formatted data, presented with appropriate user interaction capabilities. This component uses a solid typed model, helping you to create formatted formated cells. These cells can be editable if you subscribe to `onChange` method who dispatch then new dataSource with each change. + + +```jsx +import Table from 'react-toolbox/table'; + +const UserModel = { + name: {type: String} +, + twitter: {type: String} +, + birthdate: {type: Date} +, + cats: {type: Number} +, + dogs: {type: Number} +, + active: {type: Boolean} +}; + +const users = [ + {name: 'Javi Jimenez', twitter: '@soyjavi', birthdate: Date(1980, 4, 10), cats: 1} +, + {name: 'Javi Velasco', twitter: '@javivelasco', birthdate: Date(1987, 4, 10), dogs: 1, active: true} +]; + +const TableTest = () => ( +
+) +``` + +## Properties + +| Name | Type | Default | Description| +|:-----|:-----|:-----|:-----| +| `className` | `String` | `''` | Sets a class to style of the Component.| +| `dataSource` | `Array` | | array representing all items for show.| +| `model` | `Object` | | If true, component will be disabled.| +| `heading` | `Bool` | `true` | If true, component will show a heading using model field names.| +| `onChange` | `Function` | | Callback function that is fired when the components's value changes.| +| `onSelect` | `Function` | | Callback function when clicks in a determinate row.| + +## Methods + +This component has state to control how is it rendered and the values currently selected. It exposes the following instance methods: + +- `getValue` is used to retrieve the current dataSource.