【发布时间】:2013-12-16 12:41:53
【问题描述】:
我正在使用 codeigniter 的网站上工作,并且我有这张表将填充来自数据库的信息。 当我填充我的表时,它需要相当长的时间,因为我的数据库中有 15000 行,并且浏览器在加载时会卡住一两分钟。
这是我的部分代码
查看:
<div class="portlet-body">
<table class="table table-striped table-bordered table-hover table-full-width" id="sample_1">
<thead>
<tr>
<th>ID</th>
<th class="hidden-xs">Serial Number</th>
<th class="hidden-xs">Codigo</th>
<th class="hidden-xs">Estado</th>
<th class="hidden-xs">Data de inserção</th>
<th class="hidden-xs">Provider</th>
</tr>
</thead>
<tbody>
<?php foreach ($query->result_array() as $row): {
?>
<tr>
<td><?php echo $row['product_id'] ?></td>
<td><?php echo $row['serial_number'] ?></td>
<td class="hidden-xs"><?php echo $row['product_code'] ?></td>
<td class="hidden-xs"><?php echo $row['product_status'] ?></td>
<td class="hidden-xs"><?php echo $row['product_insertion_date'] ?></td>
<td class="hidden-xs"><?php echo $row['product_provider'] ?></td>
</tr>
<?php } endforeach; ?>
</tbody>
</table>
</div>
控制器:
public function loadProdutos(){
$this->load->model('produtos_model');
$tmp = $this->produtos_model->getProdutos();
$data['query'] = $tmp;
$this->load->view('produtos',$data);
}
型号:
function getProdutos() {
$query = $this->db->get('products');
return $query;
}
我的问题是,在这种情况下是否有最佳实践,或者其他方式?
【问题讨论】:
标签: php html codeigniter html-table