2016-10-10 2 views
-1

내 codeigniter 응용 프로그램의 데이터 테이블에서 내 데이터베이스의 출력을 사용하려고했습니다. 모든 공식적인 방법을 따라 왔지만 어떻게 든 생성 된 데이터 테이블은 정적 인 응답이없는 테이블 일뿐입니다. 아래 코드를 붙여 넣습니다.생성 된 비 기능 데이터 테이블

다음
<?php 

class Order_dt extends CI_Model { 

    public function getAllCustomers(){ 

     $this->load->database(); 

      $query = $this->db->get('customers'); 
    return $query->result(); 
    } 
} 

?> 

내보기입니다 : 여기

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Datatable_Control extends CI_Controller 
{ 
public function __construct() 
{ 
    parent::__construct(); 

} 

public function index() 
{ 


// $this->load->helper('url'); 
    $this->load->model('order_dt'); 

    $customer_list = $this->order_dt->getAllCustomers(); 
    $data["customers_list"] = $customer_list; 
    $this->load->view("datatable", $data); 
} 

} 

?> 

내 모델입니다 :

내 컨트롤러 나는 시도하고 얻을 수있는 가능한 모든 방법을 검색 한

<!DOCTYPE html> 
<meta charset="UTF-8"> 

<head> 
<script type="text/javascript" language="javascript" 

src="//code.jquery.com/jquery-1.11.1.min.js"></script> 


<script type="text/javascript" language="javascript" 
    src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script> 
<link rel="stylesheet" type="text/css" 

href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css"> 

<script language="javascript" type="text/javascript"> 

$(document).ready(function() { 
    $('#rahul').DataTable(); 
}); 
</script> 

</head> 

<body> 

<div class="page-header"> 
    <h1>CI-DataTables Library Example</h1> 
</div> 

<div class="row"> 
    <div class="col-md-12"> 
     <div class="panel panel-default"> 
      <div class="panel-body"> 
       <table id="rahul"> 
        <thead> 
         <tr> 
          <td><strong>Customer Number</strong></td> 
          <td><strong>Last Name</strong></td> 
          <td><strong>First Name</strong></td> 
          <td><strong>Phone</strong></td> 
          <td><strong>Address 1</strong></td> 
          <td><strong>Address 2</strong></td> 
          <td><strong>City</strong></td> 
          <td><strong>State</strong></td> 
          <td><strong>Postal Code</strong></td> 
          <td><strong>Country</strong></td> 
          <td><strong>Sales Emp No.</strong></td> 
          <td><strong>Credit Limit</strong></td> 
         </tr> 
         <?php foreach ($customers_list as $c): ?> 
         <tr> 
          <td><?php echo $c->customerNumber; ?></td> 
          <td><?php echo $c->customerName; ?></td> 
          <td><?php echo $c->contactLastName; ?></td> 
          <td><?php echo $c->contactFirstName; ?></td> 
          <td><?php echo $c->phone; ?></td> 
          <td><?php echo $c->addressLine1; ?></td> 
          <td><?php echo $c->addressLine2; ?></td> 
          <td><?php echo $c->city; ?></td> 
          <td><?php echo $c->state; ?></td> 
          <td><?php echo $c->postalCode; ?></td> 
          <td><?php echo $c->country; ?></td> 
         <td><?php echo $c->salesRepEmployeeNumber; ?> 

    </td> 
          <td><?php echo $c->creditLimit; ?></td> 
         </tr> 

         <?php endforeach ?> 
        </thead> 
        <tbody></tbody> 
       </table> 
      </div> 

     </div> 
    </div> 
</div> 
</body> 

</html> 

제대로 작동하는 데이터 테이블. 나는 내 코드가 무엇이 잘못되었거나 무엇이 빠졌는지를 알 수 없다. 안내해주십시오. 이미지 첨부 중 : enter image description here

답변

0

문제는 바보입니다. <tbody> 태그에서 테이블 데이터를 사용하고있었습니다.

관련 문제