gpt4 book ai didi

html - TABLESORTER - 如何在 TABLESORTER 中使第一列静态/固定?

转载 作者:行者123 更新时间:2023-11-28 04:08:11 25 4
gpt4 key购买 nike

我想给每一行编号,而不是让这些数字移动/排序。第一列 # 需要是静态的/固定的。所有其他列都可以根据需要进行排序。

这可能吗?

这是我的主题:

                <thead>
<tr>
<th>#</th>
<th>Part No.</th>
<th>Board</th>
<th>Status</th>
<th>Auth QTY</th>
<th>Cur QTY</th>
<th>RELS</th>
<th>WIP QTY</th>
<th>TBD</th>
</tr>
</thead>

最佳答案

我认为最好的方法是编写您自己的小部件 (demo):

// add custom numbering widget
$.tablesorter.addWidget({
id: "numbering",
format: function(table) {
var c = table.config;
$("tr:visible", table.tBodies[0]).each(function(i) {
$(this).find('td').eq(0).text(i + 1);
});
}
});

$("table").tablesorter({
// prevent first column from being sortable
headers: {
0: { sorter: false }
},
// apply custom widget
widgets: ['numbering']
});

注意:我在 github 上创建了一个 tablesorter 插件的副本。使用字母数字排序、更多示例页面和以前未记录的选项。以防万一你感兴趣:)

关于html - TABLESORTER - 如何在 TABLESORTER 中使第一列静态/固定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6833545/

25 4 0
文章推荐: html - 关于 HTML/CSS 文本的问题
文章推荐: javascript - addEventListener 在简单的 for 循环中工作,但不适用于 for-in 循环
文章推荐: CSS 使
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com