how to implement gridJS with multiple selects

51 Views Asked by At

I need to implement the typical gridJS search with a search based not on a specific column.

Let me explain better: the documentation only reports a search based on multiple columns at the same time, so if I go to search for a word the search searches for the word inserted in multiple columns.

What interests me is creating different searches, each based on a specific column.

Is it possible to do this? Can you help me please?

<html>

<head>
  <link href='https://unpkg.com/gridjs/dist/theme/mermaid.min.css' rel='stylesheet'>
  <script src="https://cdn.jsdelivr.net/npm/gridjs/dist/gridjs.umd.js"></script>
</head>

<body>
  <div id='destinationWrapper'></div>
  <table id='sourceTable'>
    <thead>
      <tr>
        <th>Name</th>
        <th>Email</th>
        <th>Phone</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>[email protected]</td>
        <td>(353) 01 222 3333</td>
      </tr>
       <tr>
        <td>Mark</td>
        <td>[email protected]</td>
        <td>(01) 22 888 4444</td>
      </tr>
      <tr>
        <td>Eoin</td>
        <td>[email protected]</td>
        <td>(05) 10 878 5554</td>
      </tr>
    </tbody>
  </table>
  
  
  <script>
  document.addEventListener("DOMContentLoaded", function() {
  new gridjs.Grid({
   search: true,
    from: document.getElementById('sourceTable')
  }).render(document.getElementById('destinationWrapper'));
});
  </script>
</body>
</html>

0

There are 0 best solutions below