【发布时间】:2015-11-02 14:41:17
【问题描述】:
我正在使用 Mottie 的 Tablesorter (https://github.com/Mottie/tablesorter),我正在尝试在格式如下的单元格上使用数学小部件;
<td data-number="50">Fifty</td>
但是我似乎不知道如何在math-complete 选项上将data-* 传递给arry;
math_complete : function($cell, wo, result, value, arry) {
var txt = '<span class="align-decimal">' +
( value === wo.math_none ? '' : '$ ' ) +
result + '</span>';
if ($cell.attr('data-math') === 'all-sum') {
// when the "all-sum" is processed, add a count to the end
return txt + ' (Sum of ' + arry.length + ' cells)';
}
return txt;
}
另外,我使用的是 v2.18.2。
【问题讨论】:
-
我需要将它集成到 TableSorter 中,因为我希望使用
math_event选项。这个解决方案只是一个通用的 jQuery 解决方案。
标签: jquery tablesorter