dongshi3818 2019-02-27 07:16
浏览 66

如何在bootstrap datatable中看到下一页上的相同名称作为标题

How to see in bootstrap datatable on next page a user name on top side. my Question is that when a user gives questions of answers in objective then its questions and answer list goes to on the next page at next page i want to see that user name continuously. My problem is coming that on next page user name showing even question and answers of that a user end on previously page. how to solve that problem when all questions and answers of user end on previously page should not show on next page of that user name.

<div id="user-answer-datatable-responsive3">
   <table id="user-answer-datatable-responsive1" class="table table-striped table-bordered dt-responsive nowrap bulk_action" cellspacing="0" width="100%">
      <thead>
         <tr>
            <th style="width: 40%;">Athlete Name/Questions</th>
            <th>Users Answer</th>
         </tr>

         <!-- <tr>
            <th style="width: 40%;">Athlete Name/Questions</th>
            <th>Users Answer</th>
         </tr>-->
       </thead>

       <tbody id="render-list-of-order1">
         <?php $rows = 1; $i=1;?>
         <?php foreach ($data['question'] as $key => $value) { ?>

             <?php if($rows % 10 != 0){ ?>
                <tr style="background-color:#f9f9f9">
                  <td colspan="2" ><b><?php echo $value['first_name'] . ' ' . $value['last_name']; ?></b></td> 
                  <td class="hidden"></td>
                </tr> 
              <?php }?>

              <?php print_r($rows++); ?>
              <?php foreach ($value['options_useranswer'] as $key => $values) {  ?>
                 <tr style="background-color:white">
                    <td  style=""><?php echo $values['questions']; ?></td>
                    <td style=""><?php echo $values['options_names']; ?></td>
                 </tr> 

                 <?php if($rows % 10 == 0 ){ 
                    print_r(($rows).'df');?>
                    <tr style="background-color:#f9f9f9">
                       <td colspan="2" ><b><?php echo $value['first_name'] . ' ' . $value['last_name']; ?></b></td> 
                       <td class="hidden"></td>
                    </tr> 
                 <?php $rows++; } ?>
                 <?php    print_r('('.($rows++).')');?>
            <?php } ?>
        <?php } ?>
     </tbody>
  </table> 
</div>

Php code:

public function answers() {
     $response = $this->Godspeed->answersData($date = '1');
     $data['data']['question'] = $response;
     $this->load->template(array("Portal/User_answer" => ""), $data);
}


foreach ($data as $key => $value) {
     $this->db->select('options.op_id,options.options_names,user_answers.q_id,question.questions,user_answers.date');
     $this->db->from('user_answers');
     $this->db->join('question', 'question.id = user_answers.q_id');
     $this->db->join('options', 'options.op_id = user_answers.ans_respons','left');
     $user_id = $value['user_id'];
     $this->db->where("user_id =  $user_id");
     $this->db->where('user_answers.date BETWEEN "' . $date_current . $times[0] . '" and "' . $date_current . $times[1] . '"');
     $query = $this->db->get();
     foreach ($query->result_array() as $resultDatas) { //while loop can be possible
           $data[$key]['options_useranswer'][] = $resultDatas;
     }
}
return $data;

Database image showing:

enter image description here

Front page image showing:

enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行