codeingiter で datatables Jquery プラグインを使用しようとしていますが、動作していません。デバッグを手伝ってください
ビューを呼び出しているコントローラーは次のとおりです。
public function show_all_merchants()
{
$data["query"]= $this->details_model->get_mids();
$this->load->view('show_merchants_view',$data);
}
私の見解は次のとおりです。
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function()
{
$('#example').dataTable
({
'bProcessing' : true,
'bServerSide' : true,
'sAjaxSource' : 'show_merchant_details',
'iDisplayStart' : 0,
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback,
'cache' : false
});
}
});
});
</script>
<table cellpadding="0" cellspacing="0" border="0" id="example">
<thead>
<tr>
<th width="20%">ID</th>
<th width="25%">First Name</th>
<th width="15%">Last Name</th>
<th width="25%">Email</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="5">Loading data from server</td>
</tr>
</tbody>
</table>
ここにデータをロードしているコントローラーがありますここでは、データテーブルライブラリをロードしています:
function show_merchant_details()
{
$this->datatables
->select('mid, merchant_name, merchant_link,merchant_contact')
->from('merchants')
->add_column('edit', '<a href="store/update/$1" title="Edit">Edit</a>', 'id')
->add_column('delete', '<a href="store/delete/$1" title="Delete">Delete</a>', 'id');
echo $this->datatables->generate();
}
友人 show_merchant_details() は、出力を見ることができるので、適切に動作しています
。ビュー ページでは、サーバーからデータを読み込んでいるのと同じように見ることができます ...... (dats it)