Fix some enhancements & new features
This commit is contained in:
@@ -8,10 +8,28 @@
|
||||
|
||||
$colvis.on( 'click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
console.log(table);
|
||||
|
||||
console.log(table.column(1).dataSrc());
|
||||
var header = table.column(1).header();
|
||||
console.log($(header).html());
|
||||
var visible = table.column(1).visible();
|
||||
console.log(visible);
|
||||
|
||||
/*
|
||||
// var names = table.columns().names();
|
||||
columns = table.columns();
|
||||
console.log(columns);
|
||||
|
||||
var names = columns.names();
|
||||
console.log(names);
|
||||
|
||||
// table.search($search.val()).draw();
|
||||
buttons = table.buttons();
|
||||
console.log(table.button('colvis'));
|
||||
console.log(buttons);
|
||||
*/
|
||||
|
||||
/*
|
||||
for (var i = buttons.length - 1; i >= 0; i--) {
|
||||
console.log(buttons[i]);
|
||||
|
||||
@@ -4,27 +4,25 @@
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item excelWithFilter"><a href="#"><i class="fa fa-file-excel"></i> Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="#" class="excelWithFilter"><i class="fa fa-file-excel"></i> Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/exportExcel"><i class="fa fa-file-excel"></i> Exporter la liste complète</a></li>
|
||||
<li class="dropdown-item"><a href="#"><i class="fa fa-file-pdf"></i> Exporter la sélection</a></li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li class="dropdown-item"><a href="#" class="pdfWithFilter"><i class="fa fa-file-pdf"></i> Exporter la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/exportPDF"><i class="fa fa-file-pdf"></i> Exporter la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('.excelWithFilter').click(function() {
|
||||
/*
|
||||
var data = $('#filters').serializeJSON();
|
||||
var query = encodeURIComponent(JSON.stringify(data));
|
||||
console.log(data);
|
||||
console.log(query);
|
||||
var url = "{{ $route }}/exportExcel?filters=" + query;
|
||||
console.log(url);
|
||||
*/
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportExcel?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
<script>
|
||||
$('.excelWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportExcel?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
$('.pdfWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/exportPDF?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<div class="datatable-export-buttons">
|
||||
|
||||
@include('components.datatables.buttons.print')
|
||||
@include('components.datatables.buttons.download')
|
||||
|
||||
@if (isset($with_exports) && $with_exports)
|
||||
@include('components.datatables.buttons.download')
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
</button>
|
||||
|
||||
<ul class="dropdown-menu" x-placement="bottom-start">
|
||||
<li class="dropdown-item btn-print"><a href="#">Imprimer la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/print">Imprimer la liste complète</a></li>
|
||||
<li class="dropdown-item printWithFilter"><a href="#" target="_BLANK">Imprimer la sélection</a></li>
|
||||
<li class="dropdown-item"><a href="{{ $route }}/print" target="_BLANK">Imprimer la liste complète</a></li>
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.button(1).trigger();
|
||||
});
|
||||
|
||||
$('.printWithFilter').click(function() {
|
||||
var data = $('#filters').serialize();
|
||||
var url = "{{ $route }}/print?" + data;
|
||||
window.location = url;
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
@@ -3,11 +3,17 @@
|
||||
@include('components.datatables.buttons.pageLength')
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control search-btn" placeholder="Rechercher..." value="">
|
||||
<div class="input-group-append">
|
||||
@include('components.datatables.buttons.filters')
|
||||
@include('components.datatables.buttons.colvis')
|
||||
</div>
|
||||
<input type="text" class="form-control search-btn" placeholder="Rechercher..." value="">
|
||||
@if ((isset($with_filters) and $with_filters) || (isset($with_colvis) and $with_colvis))
|
||||
<div class="input-group-append">
|
||||
@if (isset($with_filters) && $with_filters)
|
||||
@include('components.datatables.buttons.filters')
|
||||
@endif
|
||||
@if (isset($with_colvis) && $with_colvis)
|
||||
@include('components.datatables.buttons.colvis')
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
@@ -15,7 +21,7 @@
|
||||
var $search = $('#{{ $model }}-table-header .search-btn');
|
||||
$search.on( 'keyup click', function () {
|
||||
var table = window.LaravelDataTables["{{ $model }}-table"];
|
||||
table.search($search.val()).draw();
|
||||
} );
|
||||
table.search($search.val()).draw();
|
||||
} );
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user