首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改最后一表中的限制

更改最后一表中的限制
EN

Stack Overflow用户
提问于 2015-11-15 12:41:59
回答 1查看 31关注 0票数 0

我有下表

代码语言:javascript
复制
<table>
  <TableHeader className="execution-head"/>
    <tbody>
      <tr className={this.props.className} onClick={this.handleClick}>
        <th>{this.props.execution_id}</th>
        <th>{this.props.launch_time}</th>
        // more th's here
      </tr>
      <tr className={this.props.className} onClick={this.handleClick}>
        <th>{this.props.execution_id}</th>
        <th>{this.props.launch_time}</th>
        // more th's here
      </tr>
      <tr>
        <th>+</th>
      </tr>
    </tbody>
</table>

输出:

代码语言:javascript
复制
<table data-reactid=".1">
 <thead data-reactid=".1.0">
  <tr class="execution-head" data-reactid=".1.0.0">
     <th data-reactid=".1.0.0.0">ID</th>
     <th data-reactid=".1.0.0.1">Launch Time</th>
     <th data-reactid=".1.0.0.5">Execution Time</th>
  </tr>
 </thead>
 <tbody data-reactid=".1.1">
  <tr class="execution-row" data-reactid=".1.1.0:$4x324">
     <th data-reactid=".1.1.0:$4x324.0">4x324</th>
     <th data-reactid=".1.1.0:$4x324.1">11.11.15 13:30</th>
     <th data-reactid=".1.1.0:$4x324.5">2</th>
  </tr>
  <tr class="execution-row" data-reactid=".1.1.0:$4823748">
     <th data-reactid=".1.1.0:$4823748.0">4823748</th>
     <th data-reactid=".1.1.0:$4823748.1">13.11.15 13:30:25</th>
     <th data-reactid=".1.1.0:$4823748.5">34</th>
  <tr class="table-plus" data-reactid=".1.1.1">
     <th data-reactid=".1.1.1.0">+</th>
  </tr>
 </tbody>
</table>

我想让最后一个tr元素取整个表的宽度,但是从我尝试过的所有东西来看,总是出错的。

这是用react写的,如果你想知道

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-15 12:55:47

计算变量中th的数量,假设是col_cnt,然后在最后一个tr中可以这样写:

代码语言:javascript
复制
<tr>
 <th colspan="{col_cnt}">+</th>
</tr>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33719775

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档