javascript - 如何从表的开头 colspan tr 表

标签 javascript html css angularjs

我想从第二列开始 colspan 我的意思是从名称开始: enter image description here

enter image description here

<table width="100%">
  <thead style="background-color: lightgray;">
    <tr>
      <td style="width: 30px;"></td>
       <td><p>Name</p></td>
    <td><p>ID</p></td>
    <td><p>GPS date</p></td>
    <td><p>Adresse</p></td>
    <td><p>Company</p></td>
    </tr>  
  </thead>
  <tbody>
    <tr ng-repeat-start="device in MyDeviceObject">
      <td>
        <button ng-if="device.expanded" ng-click="device.expanded = false">-</button>
        <button ng-if="!device.expanded" ng-click="device.expanded = true">+</button>
      </td>
      <td><p>{{device.name}}</p></td>
      <td><p>{{device.uniqueid}}</p></td>
      <td><p>{{device.devicetime}}</p></td>
      <td><p>{{device.adress}}</p></td>
      <td><p>{{device.company}}</p></td>
    </tr>
    <tr  ng-if="device.expanded" ng-repeat-end="">
      <td  colspan="6">gfhgfjhfjtjrtkjy</td>
    </tr>
  </tbody>

请问谁能告诉我如何从名字中 colspan 吗??

最佳答案

看来您只需要添加一个 <td>到该行。你有:

<tr ng-if="device.expanded" ng-repeat-end="">
    <td colspan="6">gfhgfjhfjtjrtkjy</td>
</tr>

将其更改为:

<tr ng-if="device.expanded" ng-repeat-end="">
    <td style="width: 30px;"></td>
    <td colspan="5">gfhgfjhfjtjrtkjy</td>
</tr>

这应该添加一个 <td>plus/minus下方图标。此外,您可以设置此 <td> 的样式如果您不希望它显示为一列(我认为这是您的意图)。

希望对您有所帮助。

关于javascript - 如何从表的开头 colspan tr 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42996942/

相关文章:

javascript - 在加载 JavaScript 时将值替换为图像

javascript - Redux 中应该在哪里进行异步操作的存储调度?

javascript - 如何获取网页所有包含/使用的文件的 URL 列表?

jquery - 带图标的动画底部三 Angular 形

html - CSS - 在 Wordpress 中并排显示图像

Gzip 的 JavaScript 实现

HTML 复制文本时忽略空格

html - 我无法将表格与 html/css 中的嵌入式视频对齐

html - 使用 CSS/Angular 动画选项卡内容

cross-browser - 默认情况下,IE7 是否支持任何 CSS 3 属性?