使用数组将值推入自定义选择过滤器框中

问题描述

使用Mottie的jQuery Tablesorter 2.31.3。

我有一个用于特定列的自定义选择过滤器框,我想在该框上附加来自JS数组的值。我现在所拥有的:

filter_functions : {
  // custom select on 7th column: push possible status to select
  6 : {
    [activelbl] : function(e,n,f,i,$r,c,data) { return e === "• " + activelbl; },[closedlbl] : function(e,data) { return e === "• " + closedlbl; },[cancelledlbl] : function(e,data) { return e === "• " + cancelledlbl; }
  }
}

上面的所有标签都是我们之前翻译的标签

现在,我不想将这些“硬编码”到我的JS中,因为它们来自数据库查找表!我有一个JS数组,其中包含所有可能的值...

我需要知道如何从数组中动态填充自定义过滤器。像这样:

filter_functions : {
  // custom select on 7th column: push possible status to select
  6 : {
    var status_listing4jsCnt = status_listing4js.length;
    for (var i = 0; i < status_listing4jsCnt; i++) {
      [status_listing4js[i]] : function(e,data) { return e === "• " + status_listing4js[i]; },}
  }
}

但是泡沫使我遇到了Uncaught SyntaxError: Unexpected identifier错误

有什么想法我会怎么做?干杯!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)