markdown #Ignited_Datatables多表连接相同的列名
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown #Ignited_Datatables多表连接相同的列名相关的知识,希望对你有一定的参考价值。
<!--Self created Javascript file goes here-->
<script src="<?php echo base_url('cssjs_library/datatables/jquery.dataTables.min.js'); ?>" type="text/javascript"></script>
<!--[DataTables 1.10.12]-->
<script>
$(document).ready(function() {
$('#grid-table').DataTable( {
"processing": true,
"serverSide": true,
"columnDefs": [
{
"targets": [ 0 ],
"visible": false,
"searchable": false
}
],
"ajax": {
"url": "<?php echo site_url('super_admin/crud/service/grid_ajax'); ?>",
"type": "POST",
"data": function ( d ) {
delete d.columns[3];
}
}
} );
} );
</script>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">FAQ List</h3>
</div>
<div class="panel-body">
<div id="db_message" style="text-align: center;">
<?php
if (isset($db_feedback)) {
echo $db_feedback;
}
?>
</div>
<a class="btn btn-default" href="<?php echo site_url('super_admin/crud/service/add_form'); ?>" role="button"><i class="fa fa-plus-circle" aria-hidden="true"></i> Add
New</a>
<br/><br/>
<table id="grid-table" class="table table-striped">
<thead>
<tr>
<th>Service ID</th>
<th>Service</th>
<th>Office</th>
<th>FAQ Title</th>
<!-- <th>Actions</th>-->
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">Loading data from server</td>
</tr>
</tbody>
<tfoot>
<th>Service ID</th>
<th>Service</th>
<th>Office</th>
<th>FAQ Title</th>
<!-- <th>Actions</th>-->
</tfoot>
</table>
</div>
</div>
<script>
// function delete_confirm(student_id) {
// if (window.confirm('Are you sure to delete this Student Information?'))
// {
//// alert("You agree");
// window.location.href = '<?php //echo site_url('crud/student/delete'); ?>//' + '/' + student_id;
// }
// }
</script>
<?php
public function grid() {
$data['page_title'] = 'FAQ List';
$data['common_stylesheet'] = 'super_admin/stylesheet/common/admin_common_stylesheet';
$data['common_navigation'] = 'super_admin/navigation';
$data['content_page'] = 'super_admin/crud/service/service_grid';
$data['common_script'] = 'super_admin/script/common/admin_common_script';
$data['custom_script'] = 'super_admin/script/custom/crud/service/service_grid_script';
$this->load->view('super_admin/main_admin_view',$data);
}
public function grid_ajax()
{
$this->datatables->select("service.service_id,category.name as category_name,subcategory.name as subcategory_name,service.name")->where('audio_type','global')->from('service');
$this->datatables->join('category', 'category.category_id=service.category_id', 'inner');
$this->datatables->join('subcategory', 'subcategory.subcategory_id=service.subcategory_id', 'inner');
// $this->datatables->add_column("actions", "<a href='" . site_url("super_admin/crud/subcategory/edit_form/$1") . "'><i class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i></a> " . "<a href='" . site_url("super_admin/crud/subcategory/subcategory_delete/$1") . "' onClick=\"return confirm('Are you sure to delete this Office and FAQ under it?')\"><i class=\"fa fa-trash\" aria-hidden=\"true\"></i></a>", "subcategory_id");
echo $this->datatables->generate();
}
## Problem: Multiple table inner join same column name
* [CodeIgniter](http://codeigniter.com)
* [Ignited-Datatables](https://github.com/IgnitedDatatables/Ignited-Datatables)
以上是关于markdown #Ignited_Datatables多表连接相同的列名的主要内容,如果未能解决你的问题,请参考以下文章