bootstrap-table/如何在表配置中添加过滤控制 [英] bootstrap-table / How to add filter-control in table configuration

查看:149
本文介绍了bootstrap-table/如何在表配置中添加过滤控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 Bootstrap-table 中的每列设置一个过滤器.

I'm trying to make a filter per column in Bootstrap-table.

我已经看到很多网站使用 HTML data-filter-control 标签来做到这一点,但我想在 javascript 方面做到这一点;最好在表配置属性上.

I've seen a lot of sites that use the HTML data-filter-control tag to do this, but I want to do it in the javascript side; preferably on the table configuration attributes.

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

This is an HTML data-filter-control tag example:

  <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>

谢谢大家!

推荐答案

$(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,
      },
    ]

  });
});

这篇关于bootstrap-table/如何在表配置中添加过滤控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆