jQuery BootGrid-使用data-visible ="false"隐藏列从DOM中删除 [英] jQuery BootGrid - Hiding columns with data-visible="false" removes from DOM

查看:222
本文介绍了jQuery BootGrid-使用data-visible ="false"隐藏列从DOM中删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用BootGrid,可以在第th列定义中使用data-visible ="false"来隐藏列.这就产生了一个问题,即它似乎不只是隐藏该列,而是将其从DOM中删除. (前两个不显示)

With BootGrid, you can hide columns by using data-visible="false" in your th column definitions. This creates a problem in that, rather than just hiding the column, it appears to remove it from the DOM. Columns (First two do not show)

<tr>
    <th data-column-id="id" data-type="numeric" data-identifier="true" data-visible="false">ID</th>
    <th data-column-id="User" data-visible="false">User</th>
    <th data-column-id="Title">Title</th>
    <th data-column-id="Description">Description</th>
    <th data-column-id="Expire" data-formatter="expire" data-sortable="true">Expire</th>
    <th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
</tr>

问题 将ID和User设置为data-visible ="False"时,将无法访问它们的值. 使用data-visible ="false"似乎会使这些字段完全不存在.我需要能够访问这些值.

The Problem With ID and User set to data-visible="False" their values are inaccessible. Using data-visible="false" seems to make these fields non-existant altogether. I need to be able to access these values.

推荐答案

有两个数据参数:header-css-class和css-class,其用法在我阅读的文档中没有得到很好的解释. 我用display:none设置了两个类,我将其命名为"Hidecolhead"和"HideCol". 然后,在我不想在网格中显示的列(ID和用户)中,我有

There are two data parameters: header-css-class and css-class the usage of which is not well explained in the documentation I read. I set up two classes with display:none, which I named "Hidecolhead" and HideCol". Then, in the columns I do not want to display (ID and user) in the grid, I have

<th data-column-id="ID" data-header-css-class="HideColHead" data-css-class="HideCol">ID</th>
<th data-column-id="User" data-header-css-class="HideColHead" data-css-class="HideCol">User</th>

这些行列中的值现在可用.

The values in these row columns are now available.

这篇关于jQuery BootGrid-使用data-visible ="false"隐藏列从DOM中删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆