douzuan5365 2017-04-05 08:24
浏览 94

如何正确使用DATATABLE

            <table id="tbl" class = "table table-striped table-bordered" style="border-top:0px;">
      <thead>
        <tr>
          <th></th>
          <th><p style="text-align:center;">Answered</p></th>
          <th><p style="text-align:center;">Post</p></th>
          <th><p style="text-align:center;">Views</p></th>
        </tr>
      </thead>
      <tbody>
          <?php
          $res = $db->viewquestion();
            $ask_id= '';
          foreach ($res as $key => $value) {
              $ask_id = $value['iask_id'];

            ?> 

      <tr>
        <td>
          <div align="left" width="400">
            <?php echo '<a href="askpriest?iask_title='.$value['iask_title'].'">'?>
            <img src="./<?php echo $value['image']; ?>" style="border-radius:50%;float:left" width="20%" height="20%" class="pull-left"> 
            <h5><strong class="font-1-2" style="color:#59960b;border-radius:50%;float:left"><?php echo $value['iask_title']?></strong></h5>
            <br><p class="font-1-2" style="color:#000000;border-radius:50%;font-size:12px;float:left">by:<?php echo $value['firstname'].' '.$value['lastname'].' '. $value['date_send'].'<br> in '.$value['iask_topic'] ?> </p> 
             </a>
          </div>
        </td>
        <td>
          <?php
            if($value['iask_answered']==1){
          ?>
            <p align="center" style="padding-top:20px;"><span  class="fa fa-check" style="color:#59960b;"></span></p>
          <?php
            }else{
          ?> 
            <p align="center" style="padding-top:20px;font-size:30px;"><span style="color:#59960b;"></span></p>
          <?php
            }
          ?>
        </td>
          <td>
            <p class="font-1-5" style="padding-top:25px;text-align:center;" width="80"><?php echo $value['iask_post']?></p>
          </td>
          <td> 
            <p class="font-1-5" style="padding-top:25px;text-align:center;"><?php echo $value['iask_view']?> </p>
          </td>
          </div>
       </tr>
          <?php 
            }
          ?>
      </tbody>
      </table>

so i have this table and im trying to use the datatable js..

 <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css"/>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src=" //code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
      $(document).ready(function() {
            $('#tbl').DataTable();
          });
</script>

but unfortunately nothing happens on the table.. i tried searching on web and they said that the and should be equal.. so i tried to count how many is the and and they are equal.. i dont have any idea how to fix this since the only answer i get was to and should be equal.. hel

  • 写回答

2条回答 默认 最新

  • doujia8801 2017-04-05 08:29
    关注

    Your table has the id equal with "tbl" so the code should be

     $(document).ready(function() {
               $('#tbl').DataTable();
       });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序