Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery tablesorter计算行之间的百分比差异_Jquery_Tablesorter - Fatal编程技术网

Jquery tablesorter计算行之间的百分比差异

Jquery tablesorter计算行之间的百分比差异,jquery,tablesorter,Jquery,Tablesorter,我试图计算每个行上的ASK和BID之间的百分比差异,并使用widget math.js将其显示在DIFF列上 这是我的桌子: 我设置了以下选项: widgets: ["zebra", "filter", 'math'], widgetOptions : { math_data : 'math', // data-math attribute math_ignore : [0, 1], math_complete :

我试图计算每个
行上的
ASK
BID
之间的百分比差异,并使用
widget math.js
将其显示在
DIFF
列上

这是我的桌子:

我设置了以下选项:

   widgets: ["zebra", "filter", 'math'],
            widgetOptions : {             
  math_data     : 'math', // data-math attribute
  math_ignore   : [0, 1],
  math_complete : function($cell, wo, result) {
    var pct = result;
    return pct ;
    }
此功能:

    $.tablesorter.equations['custom'] = function(arry) {
        // (a+b+c)*d - (e/f)*100

       return 100 * (arry[4]/arry[5]) / arry[4];
   };
html看起来像:

<table id="myTable" class="tablesorter"> 
<thead> 
<tr> 
    <th>EXCHANGE</th> 
    <th>PAIR</th> 
    <th>ASK QUANTITY</th> 
    <th>ASK TOTAL</th> 
    <th>ASK</th> 
    <th>BID</th> 
    <th>BID TOTAL</th> 
    <th>BID QUANTITY</th> 
    <th>DIFF</th> 
</tr> 
</thead> 
<tbody>     <tr>
        <th>Liqui.io</th>
        <th>AE/ETH</th>
        <td>201.0782718600</td>
        <td>0.2855070166</td>
        <td>0.0014198800</td>
        <td>0.0013974500</td>
        <td>0.0100000000</td>
        <td>7.1558910900</td>
        <td data-math="row-custom"></td>
    </tr>    <tr>
        <th>Etherdelta</th>
        <th>AE/ETH</th>
        <td>3.741.9966441793</td>
        <td>5.5344130367</td>
        <td>0.0014790000</td>
        <td>0.0013830000</td>
        <td>0.3071114810</td>
        <td>222.0618083940</td>
        <td data-math="row-custom"></td>
    </tr></tbody> 
</table>

交换
一对
询问数量
询问总数
问
投标
投标总额
投标数量
差异
利基奥
AE/ETH
201.0782718600
0.2855070166
0.0014198800
0.0013974500
0.0100000000
7.1558910900
以太三角洲
AE/ETH
3.741.9966441793
5.5344130367
0.0014790000
0.0013830000
0.3071114810
222.0618083940
出于某种原因,它会显示一个空白单元格。你知道怎么了吗


信息:

tablesorter版本:“2.28.15”
jQuery版本:3.2.1


我想这对我有用。
arry[4]
arry[5]
以“投标总额”和“投标数量”列为目标-由于
math\u ignore
的原因,前两列被忽略。这就是你想要的吗?是的,它似乎起作用了。您使用的是什么jquery版本?该演示(因为我没有注意)使用的是v1.11.0。我把它改为使用最新版本(jQueryGit,v3.2.2-pre),它仍然可以工作,这让我觉得jQuery版本并不重要,我认为它对我有用。
arry[4]
arry[5]
以“投标总额”和“投标数量”列为目标-由于
math\u ignore
的原因,前两列被忽略。这就是你想要的吗?是的,它似乎起作用了。您使用的是什么jquery版本?该演示(因为我没有注意)使用的是v1.11.0。我将它改为使用最新版本(jQueryGit,即v3.2.2-pre),它仍然可以工作,这让我觉得jQuery版本并不重要。