首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jquery TableSorter 2.0小部件(多列过滤)插件

Jquery TableSorter 2.0小部件(多列过滤)插件
EN

Stack Overflow用户
提问于 2012-08-30 22:18:46
回答 1查看 1.2K关注 0票数 1

我想实现datepicker的一个input.The问题是,输入是在表排序插件中创建的,而我不知道如何做到这一点。

在这里你可以找到http://mottie.github.com/tablesorter/docs/example-widget-filter-custom.html的代码:https://github.com/Mottie/tablesorter/blob/master/js/jquery.tablesorter.widgets.js

EN

回答 1

Stack Overflow用户

发布于 2013-02-18 07:00:15

在版本2.7.7中,表排序筛选器小部件中添加了一个名为filter_formatter的新选项。现在,您可以添加jQuery UI日期选择器范围,以使用此选项筛选表内容。

您需要包含一个名为"jquery.tablesorter.widgets-filter-formatter.js“的新文件,并添加如下所示的代码来添加它。这是它工作的demo

代码语言:javascript
复制
$(function() {

  // call the tablesorter plugin
  $("table").tablesorter({
    theme: 'blue',
    // hidden filter input/selects will resize the columns, so try to minimize the change
    widthFixed : true,
    // initialize zebra striping and filter widgets
    widgets: ["zebra", "filter"],
    widgetOptions : {
      // jQuery selector string of an element used to reset the filters
      filter_reset : 'button.reset',
      // add custom selector elements to the filter row
      filter_formatter : {

        6 : function($cell, indx){
          return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
            from : '12/1/2012', // default from date
            to   : '2/1/2014',  // default to date
            changeMonth: true,
            changeYear : true
          });
        }

      }
    }
  });

});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12198998

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档