【问题标题】:bootstrap-table / How to add filter-control in table configurationbootstrap-table / 如何在表配置中添加过滤控制
【发布时间】:2017-10-20 14:36:41
【问题描述】:

我正在尝试在 Bootstrap-table 中为每列创建一个过滤器。

我见过很多网站使用 HTML data-filter-control 标签来做到这一点,但我想在 javascript 端做到这一点;最好放在表配置属性上。

这是一个 HTML data-filter-control 标签示例:

  <thead>
        <tr>
            <th data-field="state" data-checkbox="true"></th>
            <th data-field="prenom" data-filter-control="input" data-sortable="true">Prénom</th>
            <th data-field="date" data-filter-control="select" data-sortable="true">Date</th>
            <th data-field="examen" data-filter-control="select" data-sortable="true">Examen</th>
            <th data-field="note" data-sortable="true">Note</th>
        </tr>
    </thead>

谢谢大家!

【问题讨论】:

    标签: javascript html bootstrap-table


    【解决方案1】:
    $(function () {
      $('#table').bootstrapTable({
        filterControl: true,
        disableUnusedSelectOptions: true,
    
        columns: [
          {
            field: "first_column",
            title: "First Column",
            filterControl: 'input',
            filterControlPlaceholder: "holder",
            filterStrictSearch: false
          },{
            field:  "second_column",
            title: "Second Column",
            filterControl: 'select',
            filterStrictSearch: false,
          },
        ]
    
      });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-09
      • 2015-03-06
      • 1970-01-01
      • 2012-10-22
      • 2016-10-06
      • 2020-06-18
      • 1970-01-01
      相关资源
      最近更新 更多