jQuery Tablesorter列选择器小部件最初隐藏列 [英] jQuery Tablesorter Column Selector Widget initially hide column

查看:108
本文介绍了jQuery Tablesorter列选择器小部件最初隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此小部件的示例页面提到了一个类columnSelector-false,该类最初应隐藏将其添加到< th>的列。标签。
tablesorter列选择器示例
但即使在示例页面上它也不起作用:

The example page of this widget mentions a class "columnSelector-false" that should initially hide the column where it is added to the <th> tag. tablesorter column selector example But even on the example page it doesn't work:

<!-- columnSelector-false will initially hide the column -->
<th  class="columnSelector-false" data-priority="6" data-selector-name="Gender">Sex</th>

加载页面时,弹出选择器设置为自动,但即使我删除自动性别列仍然显示。
也许我想念最初隐藏列的含义,但在这种情况下我想知道它有什么其他含义......

When you load the page, the Popup selector is set to "Auto", but even when I remove "Auto" the "Gender" column still shows. Perhaps I missunderstand the meaning of "initially hide the column", but in that case I wonder what other meaning it has...

提示:列选择器小部件不能与colspan一起使用,但您可以使用< caption>如果它在< thead>之前插入,则标记。

Hint: The column selector widget does not work with colspan but you can use the <caption> tag instead if it is inserted before the <thead>.

推荐答案

实际上,使用columnSelector-false确实有效。如果您更改该演示中的列选择器复选框,它似乎不起作用,因为它会保存您的选择。

Actually, using "columnSelector-false" does work. It doesn't appear to work if you change the column selector checkboxes in that demo because it saves your choices.

我设置此演示,其中包含一个清除已保存的columnSelector数据的按钮,以显示此行为。

I set up this demo which includes a button to clear the saved columnSelector data, to show this behavior.

$('button.columnSelectorButton').click(function(){
    $.tablesorter.storage( $table, 'tablesorter-columnSelector', [] );
    $.tablesorter.storage( $table, 'tablesorter-columnSelector-auto', {} );
    // reload the page (for this demo only!)
    document.location.reload(true);
});

您可以通过打开浏览器开发工具并清除本地存储来执行相同操作(按删除后删除点击条目)

You can do the same thing by opening the browser development tools and clearing the local storage (press delete after clicking on the entry)

这篇关于jQuery Tablesorter列选择器小部件最初隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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