可折叠表格行不会超出单元格宽度

时间:2018-06-11 20:44:23

标签: css angularjs html-table accordion

我有一张可点击的+/-符号表。当用户点击它时,它会打开下面的div以显示更多详细信息。我遇到的问题是可折叠的div只有一个表列宽,我似乎无法将其设置为全宽。

以下是包含折叠行的表格的屏幕截图:

enter image description here

这就是展开时的样子:

enter image description here

我的HTML看起来像这样:

<div class="table-row" ng-repeat="work in item.work_history | orderBy: '-to' track by $index">
   <div class="table-cell" style="vertical-align: middle;" >
      <a class="flex collapsed"
         ng-class="{'accordion-toggle collapsed':work.campaign.length>0}"
         ng-if="work.campaign.length>0" data-toggle="collapse"
         ng-click="c.campaign(work)" href="#{{work.sys_id}}"
         role="button" aria-expanded="false" aria-controls="collapseDetails">
      </a>
   </div>
   <div class="table-cell">
      <a href="javascript:void(0)" title="Edit Work History"
         ng-click="c.newEntry(work.sys_id,'x_dnf_gw_found_work_history','newWork');">
        Edit
      </a>
   </div>
   <div class="table-cell">
      {{work.work_name}}
   </div>
   <div class="table-cell">
      {{work.from}}
   </div>
   <div class="table-cell">
      {{work.to}}
   </div>
   <div class="table-cell">
      <button title="Add Campaign" type="button" class="btn btn-link btn-xs"
              ng-click="c.newEntry(-1, 'x_campaigns','newWork')">
         Add Campaign
      </button>
   </div>
</div>
<div class="collapse" id="{{campaignDetails}}">
   <ul>
      <li ng-repeat="campaigns in c.campaign_details">
         {{campaigns.from}} - {{campaigns.to}}: {{campaigns.camp}}
      </li>
   </ul>
</div>

我知道为什么扩展的细节会出现在一个表格单元格中,但我不确定如何解决这个样式问题。谢谢你的帮助!

1 个答案:

答案 0 :(得分:0)

class "table-row"添加到您的可折叠部门

<div class="table-row" ng-repeat="work in item.work_history | orderBy: '-to' track by $index">
   <div class="table-cell" style="vertical-align: middle;" >
      <a class="flex collapsed" ng-class="{'accordion-toggle collapsed':work.campaign.length>0}" ng-if="work.campaign.length>0" data-toggle="collapse" ng-click="c.campaign(work)" href="#{{work.sys_id}}" role="button" aria-expanded="false" aria-controls="collapseDetails"></a>
   </div>
   <div class="table-cell">
      <a href="javascript:void(0)" title="Edit Work History" ng-click="c.newEntry(work.sys_id,'x_dnf_gw_found_work_history','newWork');">Edit</a>
   </div>
   <div class="table-cell">
      {{work.work_name}}
   </div>
   <div class="table-cell">
      {{work.from}}
   </div>
   <div class="table-cell">
      {{work.to}}
   </div>
   <div class="table-cell">
      <button title="Add Campaign" type="button" class="btn btn-link btn-xs" ng-click="c.newEntry(-1, 'x_campaigns','newWork')">Add Campaign</button>
   </div>
</div>
<div class="collapse table-row" id="{{campaignDetails}}">
   <ul>
      <li ng-repeat="campaigns in c.campaign_details">
         {{campaigns.from}} - {{campaigns.to}}: {{campaigns.camp}}
      </li>
   </ul>
</div>