在 Tablesorter 中,为列过滤器的下拉选项设置不同的值

In Tablesorter, setting different values to the dropdown options of a column filter

我正在使用 Tablesorter 来显示一个 table 并且我有一列带有带有多个选项的下拉过滤器。像这样:

widgetOptions : {
    filter_functions: {
        4: {
            users_all : function() {},
            users_collaborators : function() {},
            users_clients : function() {}
        }
    }
}

所有这三个值(users_all、users_collaborators 和 users_clients)都是变量,但它们显示为字符串。

有什么方法可以显示变量的内容吗?

更新 1

我想做的是用一种或另一种语言显示选项(与 table 无关)。

我试过通过 filter_selectSource 更改 select 选项,如下所示:

widgetOptions: {
    filter_selectSource: {
        4 : [ 'Client', 'Collaborator' ]
    },
    filter_functions: {
        4 : true
    }
} 

但它在 jquery.tablesorter.widgets.js:1464

上抛出错误(无法读取未定义的 属性 'format')

我正在通过 ajaxProcessing 填充 table 并且我选择这个过滤器就像任何其他过滤器一样:

ajaxUrl: '/users/table_users.php?page={page}&size={size}&{sortList:sort}&{filterList:filter}'

我尝试自己设置您的演示,完全没有问题。

一旦解决它看起来像:

widgetOptions : {
    filter_functions: {
        4: true
    },
    filter_selectSource: {
        4 : [ user_all, user_collaborators, user_clients ]
    }
}

并且我已将 class filter-select-nosort 添加到 table 中该列的 header。

您究竟想用过滤器 select 做什么?

您可以使用 filter_selectSource option (demo)

更改 select 选项
$(function () {
    $('table').tablesorter({
        theme: 'blue',
        widgets: ['zebra', 'filter'],
        widgetOptions: {
            filter_selectSource: {
                1 : [ 'Client', 'Collaborator' ]
            }
        }
    });
});