微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Jquery DataTable 中为我的 Django 应用程序搜索和排序,PostgreSQL DB 不起作用

如何解决在 Jquery DataTable 中为我的 Django 应用程序搜索和排序,PostgreSQL DB 不起作用

我正在使用 Jquery DataTable 并在我的 Django 应用程序中从 Postgresql 数据库获取数据。我可以将数据放入表格中,但无法对表格进行排序和搜索

datatables.js

// Call the dataTables jQuery plugin
$(document).ready(function() {
  $('#dataTable').DataTable();
});

index.html

<div class="card-body">
  <div class="table-responsive">
    <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
    <thead>
        <tr>
          <th>Testing Type</th>
          <th>Question</th>
          <th>Difficulty Level</th>
        </tr>
   </thead>
   {% for qiq in qa_interview_questions %}
   <tbody>
     <tr>
        <td>{{ qiq.testingtype }}</td>
        <td>{{ qiq.question }}</td>
        <td>{{ qiq.difficultylevel }}</td>
      </tr>
    </tbody>
  {% endfor %}
  </table>
</div>
</div>

不知何故,DataTable 中的搜索和排序根本不起作用。如果我对数据进行硬核,它会起作用。 我在这里做错了什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。