2017-07-15 80 views
0

这个问题已被问及几次回答,但没有答案为我工作。tablesorter不显示表上的箭头

我最近从JQuery 1.x更新到3.x,那是当箭头消失。

下面是代码:

<html> 
    <head> 
    <title>Inspections</title> 
    <link rel="Stylesheet" href="css/theme.blue.css" type="text/css" /> 
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script> 
    <script type="text/javascript" src="js/jquery.tablesorter.min.js"></script> <!-- 2.17.8 --> 

    </head> 
    <body> 
     <div id='inspectionoutstandingdiv'> 
     <h1>Inspections 
     </h1> 
     <table id='activeinspections' class='tablesorter'> 
     <thead> 
     <tr> 
     <th>Field 1 </th> 
     <th>Field 2 </th> 
     </tr> 
     </thead> 
     <tbody> 
     <tr> 
     <td>Some Data 1 </td> 
     <td>Some Data 2 </td> 
     </tr> 
     </tbody> 
     </table> 
     </div> 
     <script type="text/javascript"> 
      $('#activeinspections').tablesorter({theme:'blue'}); 
     </script> 
    </body> 
</html> 

其中一个建议是让放置在正确的停止或修改CSS为指向的.gif文件的.gif文件,但是当我打开up theme.blue.css我注意到.gif文件作为编码文本嵌入在.css中。

我用浏览器调试程序运行,看它是否在抱怨无法加载的文件。

此代码在jq和tablesorter的较早版本中使用,这些版本使用箭头的单个.gif文件。

我做错了,箭头没有显示出来?

每个Mottie的建议我加了theme: 'blue'到tablesorter调用,但是没有帮助。

然后,我将class='tablesorter'更改为class='tablesorter-blue'并且工作正常。我不认为这是一个理想的解决方案,所以我仍然想要一个答案。

+0

(https://mottie.github.io/tablesorter/docs/)你需要添加['theme'选项](https://mottie.github.io/tablesorter/docs/#theme)...将其设置为'theme:'blue''。 – Mottie

+0

我添加了{theme:'blue'},它仍然不添加箭头。分类工作(就像以前一样)。 –

+0

你确定主题的css文件正在加载吗? – Mottie

回答

1

问题是我正在使用一个名为Mottie-tablesorter-08bf513.zip的.zip文件,我应该直接从github下载Mottie的代码。

正确的代码有一个评论说,看起来是这样的:如果你使用我的[的tablesorter的叉]

/*! TableSorter (FORK) v2.xx.xx *//*