jquery Tablesorter失败/未使用内容复合体对列进行排序

jquery Tablesorter失败/未使用内容复合体对列进行排序,jquery,jquery-ui-sortable,Jquery,Jquery Ui Sortable,我试图用一些html代码制作一个排序表,但对某些列进行排序是行不通的 这是我使用的样本表 <table id='resultados' class="tbinformes-data" > <thead> <tr> <th>#</th> <th>Nombre</th> <th style="paddin

我试图用一些html代码制作一个排序表,但对某些列进行排序是行不通的

这是我使用的样本表

<table id='resultados' class="tbinformes-data" >
        <thead>
          <tr>
            <th>#</th>
            <th>Nombre</th>
            <th style="padding-right: 20px;">Descripcion</th>
            <th>Asunto</th>
            <th style="padding-right: 20px;" >Departamento</th>
            <th style="padding-right: 20px;">Adjunto</th>
            <th>Fecha</th>
        </tr>
       </thead>
       <tbody>
            {%for data in ARRDAT['DATA'] %}
            <tr>
              <td>{{loop.index}}</td>
              <td><a href="link_toPath/{{data.id}}" >{{data.name}}</a>
              </td>
              <td>
                <button class="btn btn-default btn-xs" title="Ver nota" data-toggle="tooltip" onclick="abreNotaPopUp('{{ data.note_id }}')">
                    <i class="fa fa-eye text-primary"></i>
                </button> &nbsp;
                    {{data.descrip}}
                </td>
              <td>
               {{data.asunto}}
              </td>
              <td>{{data.departamento}}</td>
              <td> 
              <a href='{{ path('descarga_adjunto_nota', { 'idNota' :  data.note_id }) }}' class="btn btn-xs btn-default" title="Descargar Adjunto" data-toggle="tooltip">
                    <span class="fa fa-link text-primary"></span>
                 </a>&nbsp;
                {{data.adjunto}}
                </td>
              <td>{{data.fecha|date('d/m/Y H:i:s')}}</td>
            </tr> 
        {% endfor %}    
       </tbody>
      </table>

#
名义
描述
阿松托
部门
阿琼托
德国福查
{ARRDAT['data']%中数据的百分比}
{{loop.index}
{{data.descripp}
{{data.asunto}
{{data.departmento}
{{data.adjunto}
{{data.fecha|date('d/m/Y H:i:s')}
{%endfor%}
所以像“”链接或按钮或大文本之类的列不会排序。。。!!
其他列都是很好的排序,带有一个简短的文本…

我认为第三列是
标记,而不是
标记,所以请更正它

要对包含链接和按钮的列中的值进行排序,需要添加自定义解析器,如下所示:

<script type="text/javascript">
    // add parser through the tablesorter addParser method 
    $.tablesorter.addParser({
        // set a unique id 
        id: 'linksandButtons',
        is: function(s)
        {
            // return false so this parser is not auto detected 
            return false;
        },
        format: function(s)
        {
            // format your data for normalization 
            var textwithoutopeningTag = s.replace(new RegExp(/<.*?>/),"");
            var textwithoutclosingTag = textwithoutopeningTag.replace(new RegExp(/<.*?>/),"");
            return textwithoutclosingTag.trim();
        },
        // set type, either numeric or text
        type: 'text'
    }); 


    // Apply "links" parser to the appropriate column
    $(document).ready(function()
    {
        $("#resultados").tablesorter({
            headers: {
                1: {
                    sorter: 'linksandButtons'
                },
                2: {
                    sorter: 'linksandButtons'
                },
                5: {
                    sorter: 'linksandButtons'
                }
            }
    });
</script>

//通过tablesorter addParser方法添加解析器
$.tablesorter.addParser({
//设置一个唯一的id
id:'链接和按钮',
is:功能
{
//返回false,因此不会自动检测到此解析器
返回false;
},
格式:函数
{
//格式化数据以进行规范化
var textwithoutopeningTag=s.replace(新的RegExp(/),“”);
var textwithoutclosingTag=textwithoutopeningTag.replace(新的RegExp(//),“”);
返回不带closingtag.trim()的文本;
},
//设置类型,数字或文本
键入:“文本”
}); 
//将“链接”解析器应用于适当的列
$(文档).ready(函数()
{
$(“#resultados”).tablesorter({
标题:{
1: {
分拣机:“链接和按钮”
},
2: {
分拣机:“链接和按钮”
},
5: {
分拣机:“链接和按钮”
}
}
});

我有一个解决方案,但我无法发布答案,我试图向其他用户提供有用的答案。我有另一个解决方案,但我无法发布!!Thnx