|
39 | 39 | * [onDataSizeChange](#onDataSizeChange)
|
40 | 40 |
|
41 | 41 | ### <a name='keyField'>keyField(**required**) - [String]</a>
|
42 |
| -Tells `react-bootstrap-table2` which column is unique. |
| 42 | +Tells `react-bootstrap-table2` which column of the data is unique. This should be the name of a property that is unique for each item in your dataset |
43 | 43 |
|
44 | 44 | ### <a name='data'>data(**required**) - [Array]</a>
|
45 | 45 | Provides data for your table. It accepts a single Array object.
|
46 | 46 |
|
| 47 | +Each item in this array is an object that represents a row in the table. Each "Row" object should have a key-value pair for each column in the table, whose key matches that column's dataField value. |
| 48 | + |
| 49 | +For example, if your column definitions look like: |
| 50 | + |
| 51 | +```js |
| 52 | +columns = [ |
| 53 | + { dataField: 'id', text: 'Id' }, |
| 54 | + { dataField: 'name', text: 'Name' }, |
| 55 | + { dataField: 'animal', text: 'Animal' }, |
| 56 | +] |
| 57 | +``` |
| 58 | + |
| 59 | +Then your data might look like: |
| 60 | + |
| 61 | +```js |
| 62 | +data = [ |
| 63 | + { id: 1, name: 'George', animal: 'Monkey' } |
| 64 | + { id: 2, name: 'Jeffrey', animal: 'Giraffe' } |
| 65 | + { id: 3, name: 'Alice', animal: 'Giraffe' } |
| 66 | + { id: 4, name: 'Alice', animal: 'Tiger' } |
| 67 | +] |
| 68 | +``` |
| 69 | + |
| 70 | +And your "keyField" would be `id` |
| 71 | + |
47 | 72 | ### <a name='columns'>columns(**required**) - [Object]</a>
|
48 | 73 | Accepts a single Array object, please see [columns definition](./columns.md) for more detail.
|
49 | 74 |
|
|
0 commit comments