【发布时间】:2020-09-19 05:12:46
【问题描述】:
您好,我使用 react js,我是新手。我想用Table paginationmaterial-ui 做一个不属于material-ui 的表。比如我要每页2 行。我用reactStrap 表。如果可能的话,告诉我怎么做。
render() {
const items = this.props.items.map(item => {
return (
<tr key={item.id}>
<td>
<div style={{ width: "110px" }}>
<Button
color="success"
buttonLabel="Edit"
item={item}
updateState={this.props.updateState}
>
Edit
</Button>
<Button color="danger" onClick={() => this.deleteItem(item.id)}>
Del
</Button>
</div>
</td>
<th scope="row">{item.id}</th>
<td>{item.name}</td>
<td>{item.username}</td>
<td>{item.email}</td>
</tr>
);
});
return (
<div
style={{
maxHeight: "600px",
overflowY: "auto"
}}
>
<Table responsive hover>
<thead>
<tr>
<th>Action</th>
<th>ID</th>
<th>name</th>
<th>username</th>
<th>email</th>
</tr>
</thead>
<tbody>{items}</tbody>
</Table>
</div>
);
}
}
你可以在CodeSandbox看到我的桌子。提前感谢你的回答
【问题讨论】:
标签: arrays reactjs pagination fetch