Tha main search box does not filter/search all columns

Tha main search box does not filter/search all columns

Jack LJack L Posts: 5Questions: 2Answers: 0

My data tables main search box does not filter/search the content of column 0 (File Name) and column 1 (Description)

This is the code I used

Index.html

<!DOCTYPE html>
<html>
  
  <head>
    <base target="_top">
    
    <script src="https://code.jquery.com/jquery-3.7.0.js"></script>   
    <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>  
    <script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>   
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">   



    <?!= include('JavaScript'); ?> 
  </head>
 
  <body>
    <div class="container">
      <br>
      <div class="row">
        <div class="col-20">
          <p class="h4 mb-4 text-center p-3">Search Database</p>
          <table id="data-table" class="table table-striped table-sm table-hover table-bordered">  
          
          </table>
        </div>
      </div>
    </div>  
  </body>
</html>

JavaScript.html

<script>
  
google.script.run.withSuccessHandler(showData).getData();

function showData(dataArray) {
  $(document).ready(function () {
    $('#data-table').DataTable({
      data: dataArray,

      columns: [
        { "title": "File Name" },
        { "title": "Description" },
        { "title": "File Type" },
        { "title": "Category" },
        { "title": "Topic"},
        { "title": "File Extension" },
        { "title": "File Link",
            "render": function(data, type, row, meta){
              if(type === 'display'){
                data = '<a href="' + data + '">' + 'Link Here' + '</a>';
              }
              return data;
            }
        },
        { "title": "Uploaded By" },
        { "title": "Upload Date" },
      ]
    });
  });
}

</script>

Is there a way to fix this issue ?

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.