1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/views/datatable.blade.php

60 lines
1.8 KiB
PHP
Raw Normal View History

2013-12-05 16:23:24 +01:00
<table class="table table-striped {{ $class = str_random(8) }}">
2013-12-01 08:33:17 +01:00
<colgroup>
@for ($i = 0; $i < count($columns); $i++)
<col class="con{{ $i }}" />
@endfor
</colgroup>
<thead>
<tr>
@foreach($columns as $i => $c)
2013-12-11 21:33:44 +01:00
<th align="center" valign="middle" class="head{{ $i }}"
@if ($c == 'checkbox')
2013-12-30 21:17:45 +01:00
style="width:20px"
2013-12-11 21:33:44 +01:00
@endif
>
2013-12-05 21:25:20 +01:00
@if ($c == 'checkbox' && $hasCheckboxes = true)
2013-12-11 12:11:59 +01:00
<input type="checkbox" class="selectAll"/>
2013-12-01 08:33:17 +01:00
@else
{{ $c }}
@endif
</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($data as $d)
<tr>
@foreach($d as $dd)
<td>{{ $dd }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
<script type="text/javascript">
jQuery(document).ready(function(){
// dynamic table
jQuery('.{{ $class }}').dataTable({
2014-02-18 22:56:18 +01:00
"bAutoWidth": false,
2013-12-29 18:40:11 +01:00
@if (isset($hasCheckboxes) && $hasCheckboxes)
2014-02-18 22:56:18 +01:00
'aaSorting': [['1', 'asc']],
// Disable sorting on the first column
"aoColumnDefs": [ {
'bSortable': false,
'aTargets': [ 0, {{ count($columns) - 1 }} ]
2013-12-01 08:33:17 +01:00
} ],
@endif
@foreach ($options as $k => $o)
{{ json_encode($k) }}: {{ json_encode($o) }},
@endforeach
@foreach ($callbacks as $k => $o)
{{ json_encode($k) }}: {{ $o }},
@endforeach
"fnDrawCallback": function(oSettings) {
if (window.onDatatableReady) {
window.onDatatableReady();
}
}
});
});
</script>