# \[DATATABLE] DataTables.net with DataTableQueryBuilder sample input filter (ok)

<figure><img src="https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1E4Gk2ppVKb4olmnun%2Fuploads%2FlCWHxcjusG853IHBtP1v%2Fimage.png?alt=media&#x26;token=a17a8c02-db0c-405f-b07e-9a142bef0ae1" alt=""><figcaption></figcaption></figure>

C:\xampp\htdocs\wpclidemo\index.html

```html
<!DOCTYPE html>
<html>
  <head>
    <title>Parcel Sandbox</title>
    <meta charset="UTF-8" />
  </head>
  <body>
    <h1>DataTables.net with DataTableQueryBuilder sample</h1>
    <div id="filters">
      <input type="text" data-column="id" placeholder="Id" />
      <input type="text" data-column="fullName" placeholder="Full Name" />
      <input type="text" data-column="email" placeholder="Email" />
      <input type="text" data-column="posts" placeholder="Posts" />
      <input type="text" data-column="createDate" placeholder="MM/DD/YYYY" />
    </div>
    <table id="user-list" class="display" style="width: 100%;">
      <thead>
        <tr>
          <th>Id</th>
          <th>Full name</th>
          <th>Email</th>
          <th>Company</th>
          <th>Posts</th>
          <th>Create Date</th>
        </tr>
      </thead>
    </table>
    <script src="src/index.js"></script>
  </body>
</html>

```

C:\xampp\htdocs\wpclidemo\package.json

```json
{
  "name": "datatablesnet-with-datatablequerybuilder",
  "version": "1.0.0",
  "description": "",
  "main": "index.html",
  "scripts": {
    "start": "parcel index.html --open",
    "build": "parcel build index.html"
  },
  "dependencies": {
    "datatables": "1.10.18",
    "jquery": "3.6.0",
    "parcel-bundler": "^1.6.1"
  },
  "devDependencies": {
    "@babel/core": "7.2.0"
  },
  "resolutions": {
    "@babel/preset-env": "7.13.8"
  },
  "keywords": []
}

```

C:\xampp\htdocs\wpclidemo\src\index.js

```javascript
import "./styles.css";
import $ from "jquery";
import dt from "datatables";
import "datatables/media/css/jquery.dataTables.css";
dt(window, $);
const apiUrl =
  "https://query-builder-sample-api.entrypointdev.com/API/UserList.DataTables";
$(document).ready(function () {
  let dt = $("#user-list").DataTable({
    processing: true,
    serverSide: true,
    ajax: {
      url: apiUrl,
      type: "POST"
    },
    columns: [
      { name: "id", data: "id" },
      { name: "fullName", data: "fullName" },
      { name: "email", data: "email" },
      { name: "companyName", data: "companyName" },
      { name: "posts", data: "posts" },
      { name: "createDate", data: "createDate" }
    ]
  });
  $("#filters input").each(function () {
    let columnName = $(this).data("column");
    $(this).on("change", function () {
      let col = dt.column(columnName + ":name");
      if (col.search() !== this.value) col.search(this.value).draw();
    });
  });
});

```

C:\xampp\htdocs\wpclidemo\src\styles.css

```css
body {
  font-family: sans-serif;
  margin: 2rem;
}

#filters {
  margin: 3rem 0 1.5rem 0;
}

#user-list th {
  text-align: left;
}

```

{% file src="https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1E4Gk2ppVKb4olmnun%2Fuploads%2FprNtijgqkVkLbihRFlq0%2Fdatatablesnet-with-datatablequerybuilder-forked.zip?alt=media&token=453fc500-9ddf-4ed2-898e-b7ff18d6d423" %}
