app/views/branches/index.html.erb
<section class="content-header">
</section>
<section class="content">
<div class="box">
<div class="box-header">
<h3 class="box-title">Branch</h3>
<div class="box-tools pull-right">
<div class="btn-group">
<%= link_to "Add Branch", new_branch_path, class: "btn btn-primary" %>
</div>
</div>
</div>
<div class="box-body">
<div class="">
<table class="table" id="branches-table" >
<thead>
<tr>
<th> Actions </th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</section>
<script>
$(document).on('turbolinks:load', function() {
$('#branches-table').dataTable({
"processing": true,
"serverSide": true,
"ajax": $('#branches-table').data('source'),
"pagingType": "full_numbers",
"columns": [
{ "data": "actions", "sortable": false }
]
// pagingType is optional, if you want full pagination controls.
// Check dataTables documentation to learn more about
// available options.
});
});
</script>