【发布时间】:2018-05-04 19:55:06
【问题描述】:
我正在 reactjs 中创建一个引导表。该表在每个列标题下方都有一个过滤器。
以下是代码:
<table className="table table-striped">
<thead>
<tr>
<th>#</th>
<th onClick={() => this.handleColumnSort("id")}><b>Id</b> <i className={`fa fa-fw ${this.handleColumnSortCss("id")}`}></i></th>
<th onClick={() => this.handleColumnSort("name")}><b>Name</b> <i className={`fa fa-fw ${this.handleColumnSortCss("name")}`}></i></th>
<th onClick={() => this.handleColumnSort("munit")}><b>Munit</b> <i className={`fa fa-fw ${this.handleColumnSortCss("munit")}`}></i></th>
<th onClick={() => this.handleColumnSort("rate")}><b>Rate</b> <i className={`fa fa-fw ${this.handleColumnSortCss("rate")}`}></i></th>
</tr>
<tr>
<th></th>
<th><input type="text" onChange={(e) => this.onChangeHandler("id",e)}/></th>
<th><input type="text" onChange={(e) => this.onChangeHandler("name",e)}/></th>
<th><input type="text" onChange={(e) => this.onChangeHandler("munit",e)}/></th>
<th><input type="text" onChange={(e) => this.onChangeHandler("rate",e)}/></th>
</tr>
</thead>
<tbody>
{this.props.items.filtereditems.map((item,index) => (
<tr key={index} >
<th> {(index+1)+((this.props.page_number-1)*(this.props.page_size))}</th>
<td> {item.id}</td>
<td> {item.name}</td>
<td> {item.munit}</td>
<td> {item.rate}</td>
</tr>
))}
</tbody>
</table>
但是没有输入它看起来好多了,它会自动调整到内容宽度。
那么如何在输入宽度不扩展到最大的情况下实现上述布局。
【问题讨论】:
标签: css reactjs bootstrap-4