首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >在Bootstrap表中隐藏表列

在Bootstrap表中隐藏表列
EN

Stack Overflow用户
提问于 2014-11-23 05:43:36
回答 2查看 1.8K关注 0票数 0

我创建了一个表,并使用折叠可见性试图隐藏许多列,使其不被显示。列仍然显示,只是它们显示为空白。我想让它看起来好像这些列不存在一样。之所以存在,是因为有一个搜索框可以搜索表数据。我想让它搜索这些项目,而不是显示它们。

代码语言:javascript
运行
复制
<table id='example1' class='table table-bordered table-striped'>
    <thead>
        <tr>
            <th>Ticket #</th>
            <th>Date</th>
            <th>Subject</th>
            <th>Status</th>
            <th>Close Date</th>
            <th>Assigned To</th>
            <th>Work Order</th>
            <th style='visibility:collapse;'>TID #</th>
            <th style='visibility:collapse;'>Modem #</th>
            <th style='visibility:collapse;'>MHL #</th>
            <th style='visibility:collapse;'>Waybill #</th>
            <th style='visibility:collapse;'>TID #</th>
            <th style='visibility:collapse;'>ATM Brand</th>
            <th style='visibility:collapse;'>ATM Model</th>
            <th style='visibility:collapse;'>EPP Serial</th>
            <th style='visibility:collapse;'>Router #</th>
        </tr>
    </thead>
    <tbody>"; // output data of each row 
while($row = $result->fetch_assoc()) { $href='"#"'; echo "
        <tr>
            <td><a href='tickets.php?id=".$row[' id ']."'>".$row['id']."</a>
            </td>
            <td>".$row['timecreated']."</td>
            <td>".$row['subject']."</td>
            <td>".$row['status']."</td>
            <td>".$row['closedate']."</td>
            <td>".$row['assignedtoname']."</td>
            <td>".$row['workorder']."</td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
            <td style='visibility:collapse;'></td>
        </tr>"; } } else { echo "0 results"; } echo "</tbody>
    <tfoot>
        <tr>
            <th>Ticket #</th>
            <th>Date</th>
            <th>Subject</th>
            <th>Status</th>
            <th>Close Date</th>
            <th>Assigned To</th>
            <th>Work Order</th>
            <th style='visibility:collapse;'>TID #</th>
            <th style='visibility:collapse;'>Modem #</th>
            <th style='visibility:collapse;'>MHL #</th>
            <th style='visibility:collapse;'>Waybill #</th>
            <th style='visibility:collapse;'>TID #</th>
            <th style='visibility:collapse;'>ATM Brand</th>
            <th style='visibility:collapse;'>ATM Model</th>
            <th style='visibility:collapse;'>EPP Serial</th>
            <th style='visibility:collapse;'>Router #</th>
        </tr>
    </tfoot>
</table>
EN

回答 2

Stack Overflow用户

发布于 2014-11-23 06:19:34

将“可见性:折叠;”更改为“显示:无;”

票数 0
EN

Stack Overflow用户

发布于 2014-11-23 06:34:20

根据https://developer.mozilla.org/en-US/docs/Web/CSS/visibility的说法,似乎您必须使用display none。

表格的行、列、列组和行组的

折叠隐藏了行或列,并删除了它们本应占用的空间(就好像将显示:无应用于表的列/行一样)。但是,仍然计算其他行和列的大小,就好像折叠的行或列中的单元格存在一样。这是为从表中快速删除行/列而设计的,而不必重新计算表的每个部分的宽度和高度。对于XUL元素,元素的计算大小始终为零,而不管通常会影响大小的其他样式,尽管边距仍然有效。对于其他元素,折叠与隐藏的处理方式相同。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27082898

复制
相关文章

相似问题

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