Search code examples
reactjsreact-bootstrap-table

React Bootstrap Table KeyField with two Primary Key


I have a table with two columns that are both primary keys. How do I define the KeyField with two primary key?

prikeyarr contains [book_id, author_id].

<BootstrapTable keyField={props.prikeyarr} data={props.records} columns={columns} striped />

The code above gives me error warnings...

Therefore, in this case, I can only put one primary key as the keyField.


Solution

  • keyField(required) - [String]

    BootstrapTable

    I would make it in combination string, for example

    primaryKeyString=`${book_id}_${author_id}`