I am using React and React-Table version 7. It is working well for me, but I want to add a checkbox to my top-level header. So I tried it like this:
const columns = React.useMemo(
() => [
{
Header: 'Monster Types <input type="checkbox" id="horns" name="horns">',
columns: [
{
Header: 'Possible Dungeons',
accessor: 'dungeonNames',
Cell: ({ row }) => <div>{row.original.dungeonNames.join(', ')}</div>,
Filter: TraineeSelectColumnFilter,
sortType: "basic",
filter: 'includes'
},
{
Header: 'Monsters',
accessor: 'monsterNames',
...
But when I do that, it just prints out the HTML and not the actual checkbox.
So it looks like this:
Monster Types<input type="checkbox" id="horns" name="horns">
Does anyone know of a way to add an HTML input beside a React-Table header?
Thanks!
question from:
https://stackoverflow.com/questions/65902643/adding-an-html-input-control-to-a-header-in-react-table 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…