Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proof of concept of adding sort functionality in to tables #882

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions application/modules/clients/views/partial_client_table.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="table-responsive">
<table class="table table-hover table-striped">
<table class="table table-hover table-striped" id="sort">
<thead>
<tr>
<th><?php _trans('active'); ?></th>
Expand All @@ -13,13 +13,13 @@
<tbody>
<?php foreach ($records as $client) : ?>
<tr>
<td>
<td data-table-header="<?php _trans('active'); ?>">
<?php echo ($client->client_active) ? '<span class="label active">' . trans('yes') . '</span>' : '<span class="label inactive">' . trans('no') . '</span>'; ?>
</td>
<td><?php echo anchor('clients/view/' . $client->client_id, htmlsc(format_client($client))); ?></td>
<td><?php _htmlsc($client->client_email); ?></td>
<td><?php _htmlsc($client->client_phone ? $client->client_phone : ($client->client_mobile ? $client->client_mobile : '')); ?></td>
<td class="amount"><?php echo format_currency($client->client_invoice_balance); ?></td>
<td data-table-header="<?php _trans('client_name'); ?>"><?php echo anchor('clients/view/' . $client->client_id, htmlsc(format_client($client))); ?></td>
<td data-table-header="<?php _trans('email_address'); ?>"><?php _htmlsc($client->client_email); ?></td>
<td data-table-header="<?php _trans('phone_number'); ?>"><?php _htmlsc($client->client_phone ? $client->client_phone : ($client->client_mobile ? $client->client_mobile : '')); ?></td>
<td data-table-header="<?php _trans('balance'); ?>"class="amount"><?php echo format_currency($client->client_invoice_balance); ?></td>
<td>
<div class="options btn-group">
<a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" href="#">
Expand Down Expand Up @@ -66,3 +66,16 @@
</tbody>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/dataTables.bootstrap.min.js"></script>
<script src "https://cdn.datatables.net/plug-ins/1.10.15/sorting/stringMonthYear.js"></script>

<script>
$(document).ready(function() {
$("#sort").DataTable({
"paging": false,
"searching": false,
"info": false,
});
});
</script>
1 change: 1 addition & 0 deletions application/modules/layout/views/includes/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<link rel="icon" type="image/png" href="<?php echo base_url(); ?>assets/core/img/favicon.png">

<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="<?php _theme_asset('css/style.css'); ?>">
<link rel="stylesheet" href="<?php _core_asset('css/custom.css'); ?>">

Expand Down