jQuery Tablesorter-列未按字母顺序排序

jQuery Tablesorter-列未按字母顺序排序,jquery,tablesorter,Jquery,Tablesorter,我不确定这里出了什么问题。这是网页: 第一列进行排序,但没有按正确的顺序(字母顺序)返回数据 该表本身由一个自定义PHP函数生成,该函数从WordPress数据库中提取信息。我认为这可能是问题所在,但正如您所看到的,第四列(结束日期)排序正确。我还认为可能是第一列中的链接把事情搞砸了,但是添加了文本提取代码完全破坏了排序 这是我目前用来调用Tablesorter的jQuery代码: <script type="text/javascript" id="js"> jQuery(

我不确定这里出了什么问题。这是网页:

第一列进行排序,但没有按正确的顺序(字母顺序)返回数据

该表本身由一个自定义PHP函数生成,该函数从WordPress数据库中提取信息。我认为这可能是问题所在,但正如您所看到的,第四列(结束日期)排序正确。我还认为可能是第一列中的链接把事情搞砸了,但是添加了文本提取代码完全破坏了排序

这是我目前用来调用Tablesorter的jQuery代码:

<script type="text/javascript" id="js">

   jQuery(document).ready(function($) { 
       $(document).ready(function() {
          // call the tablesorter plugin, the magic happens in the markup
          $("#projectTable").tablesorter({ 
              // pass the headers argument and assing a object 
              //debug: true,
              //sortList: [[0,0]],
              headers: { 
                  0: { 
                  // set the column to sort as text  
                      sorter: 'text',
                  },
                  // assign the secound column (we start counting zero) 
                  1: { 
                      // disable it by setting the property sorter to false 
                      sorter: false,
                  }, 
                  // assign the third column (we start counting zero) 
                  2: { 
                      // disable it by setting the property sorter to false 
                      sorter: false
                  },
                  3: {
                        sorter:'digit'
                  }
              }


          });

               // Works only with plugin modification
                $("#projectTable").bind("sortStart",function(e) { 
                    if( $(e.target).hasClass('header') ) {
                        $("#overlay").show();
                    }
                }).bind("sortEnd",function(e) {
                    if( $(e.target).hasClass('header') ) {
                        $("#overlay").hide();
                    }
                });

         });
    }); 
</script>

jQuery(文档).ready(函数($){
$(文档).ready(函数(){
//调用tablesorter插件,神奇就发生在标记中
$(“#projectTable”).tablesorter({
//传递headers参数并分配对象
//是的,
//排序列表:[[0,0]],
标题:{
0: { 
//将列设置为按文本排序
分拣机:“文本”,
},
//分配secound列(我们开始计算零)
1: { 
//通过将属性分类器设置为false来禁用它
分拣员:错,
}, 
//分配第三列(我们开始计算零)
2: { 
//通过将属性分类器设置为false来禁用它
分拣员:错
},
3: {
分拣机:“数字”
}
}
});
//仅适用于插件修改
$(“#projectTable”).bind(“sortStart”,函数(e){
if($(e.target).hasClass('header')){
$(“#覆盖”).show();
}
}).bind(“分拣机”,功能(e){
if($(e.target).hasClass('header')){
$(“#覆盖”).hide();
}
});
});
}); 

谢谢你的帮助

问题在于它是按链接中的URL排序的,而不是按文本排序的


您可能需要创建一个自定义排序条件(
textextextraction
属性)来解决这个问题。

您需要将
textextextraction
定义为
complex
,因为元素中有链接


请参阅:

我尝试在上面代码的“headers”行之前添加textextextraction:complex,但它完全破坏了排序。我也尝试了文档中列出的关于文本提取的所有示例,但它们也不起作用-我可能没有把它们放在正确的位置?谢谢你的帮助!没关系!!:)我在单词“complex”的周围加上了单引号,效果很好。非常感谢。