我似乎无法让Mottie的Tablesorter“ emptyTo”正常工作,排序工作正常,但是空单元格排序到了我不希望的顶部。我没有尝试做任何特别的事情,我只是对常规文本进行排序,并且碰巧有空单元格,我希望将其排在最底端。
我尝试从以下网址使用“ emptyTo”表排序器属性:http ://mottie.github.io/tablesorter/docs/example-option-sort-empty.html,但空格仍排在顶部。
这些是包含的脚本:
我正在使用coffeescript:
tableOptions =
emptyTo: 'bottom', //<---- This is the property that should work but isn't :(
showProcessing: true,
widthFixed: true,
widgets: ['zebra', 'stickyHeaders'],
widgetOptions:
stickyHeaders: '',
stickyHeaders_offset: 0,
stickyHeaders_cloneId: '-sticky',
stickyHeaders_addResizeEvent: true,
stickyHeaders_includeCaption: true,
stickyHeaders_zIndex: 2,
stickyHeaders_attachTo: null,
stickyHeaders_filteredToTop: true
stickyHeaders_attachTo: '.scroll'
然后...
$ ->
$('.tablesorter').tablesorter(tableOptions)
我的表结构是标准的tablesorter结构:
<table class="tablesorter">
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr><td></td></tr>
</tbody>
</table>
我还在此应用程序中使用了引导程序,因此我不确定是否会以任何方式影响它...让我知道我是否缺少某些内容。
该配置是正确的,它具有一些冗余设置(即无论如何都是默认设置),但总比后悔要安全。第2行上的注释不是有效的CoffeeScript语法,但这是为了在Stack Overflow上构成。
既然您已经提到过,表格是使用javascript(或CoffeeScript,它是一回事)生成的,则生成数据和使用tablesorter的顺序很重要:
如果使用工作流工具(例如grunt,gulp等),并且脚本被编译为单个脚本,那么遵守此顺序也很重要。列出的两个工具都可以指定包含脚本的顺序。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句