Skip to content

Update keyField/data props Documentation #1362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,36 @@
* [onDataSizeChange](#onDataSizeChange)

### <a name='keyField'>keyField(**required**) - [String]</a>
Tells `react-bootstrap-table2` which column is unique.
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

### <a name='data'>data(**required**) - [Array]</a>
Provides data for your table. It accepts a single Array object.

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.

For example, if your column definitions look like:

```js
columns = [
{ dataField: 'id', text: 'Id' },
{ dataField: 'name', text: 'Name' },
{ dataField: 'animal', text: 'Animal' },
]
```

Then your data might look like:

```js
data = [
{ id: 1, name: 'George', animal: 'Monkey' }
{ id: 2, name: 'Jeffrey', animal: 'Giraffe' }
{ id: 3, name: 'Alice', animal: 'Giraffe' }
{ id: 4, name: 'Alice', animal: 'Tiger' }
]
```

And your "keyField" would be `id`

### <a name='columns'>columns(**required**) - [Object]</a>
Accepts a single Array object, please see [columns definition](./columns.md) for more detail.

Expand Down