我用的 tablesorter jquery插件配对这个伟大的 tablesorter过滤器 插件。

我有一个选择框在我的网页,其中包含一个清单所列的我的表。我希望能够限制过滤器以只选择列当用户选择的选择。

到目前为止,我已经连接的一个事件的选择箱像这样:

$('#SelectedColumn').bind("change", columnSelected);

处理程序,像这样:

function columnSelected() {
  var selected = $(this).val();
  $.tablesorterFilter.defaults.filterColumns = [selected];
}

这并正确地设定缺省值滤列,但当过滤器的情况,它实际上并没有使用价值。它出现的插件允许设定过滤列只有在建设中。或者我jquery newbiness不能找出如何获得在的位的数据,我需要翻转。

有帮助吗?

解决方案

这让我我在蛮力排序的方式希望。仍然在寻找更好的解决方案。

function columnSelected() {
  var selected = $(this).val();
  $('#GoToTextBox').val('').focus();
  if (selected == 'Any') {
    $table.get(0).config.filter[0].filterColumns = null;
  } else {
    $table.get(0).config.filter[0].filterColumns = [selected];
  }
}

其他提示

我工作宽度jFilterSelect的过滤器的tablesorter:

http://www.jordigirones.com/131-filtros -desplegables-CON-tablesorter.html

我有同样的问题。在选择框的变化时,只需重新加载页面,你的问题将得到解决。

<select name="search" id="search" onchange="refreshPage()" >

function refreshPage(){
        location.reload();
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top