Skip to content

Commit

Permalink
removed dependency of datatable js
Browse files Browse the repository at this point in the history
  • Loading branch information
bvipul committed Dec 15, 2017
1 parent e909ea2 commit 70f90f6
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/views/Stubs/create_view.stub
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@section('content')
{{ Form::open(['route' => 'admin.dummy_small_plural_model.store', 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'post', 'id' => 'create-dummy_small_model']) }}

<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.dummy_small_plural_model.create') }}</h3>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Stubs/edit_view.stub
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@section('content')
{{ Form::model($dummy_small_model, ['route' => ['admin.dummy_small_plural_model.update', $dummy_small_model], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'id' => 'edit-dummy_small_model']) }}

<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.dummy_small_plural_model.edit') }}</h3>

Expand Down
2 changes: 1 addition & 1 deletion src/views/Stubs/index_view.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@endsection

@section('content')
<div class="box box-success">
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.dummy_small_plural_model.management') }}</h3>

Expand Down
67 changes: 66 additions & 1 deletion src/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,72 @@
}
});
FinBuilders.DataTableSearch.init(dataTable);
(function (dataTable) {
// Header All search columns
$("div.dataTables_filter input").unbind();
$("div.dataTables_filter input").keypress( function (e)
{
if (e.keyCode == 13)
{
dataTable.fnFilter( this.value );
}
});
// Individual columns search
$('.search-input-text').on( 'keypress', function (e) {
// for text boxes
if (e.keyCode == 13)
{
var i =$(this).attr('data-column'); // getting column index
var v =$(this).val(); // getting search input value
dataTable.api().columns(i).search(v).draw();
}
});
// Individual columns search
$('.search-input-select').on( 'change', function (e) {
// for dropdown
var i =$(this).attr('data-column'); // getting column index
var v =$(this).val(); // getting search input value
dataTable.api().columns(i).search(v).draw();
});
// Individual columns reset
$('.reset-data').on( 'click', function (e) {
var textbox = $(this).prev('input'); // Getting closest input field
var i =textbox.attr('data-column'); // Getting column index
$(this).prev('input').val(''); // Blank the serch value
dataTable.api().columns(i).search("").draw();
});
//Copy button
$('#copyButton').click(function(){
$('.copyButton').trigger('click');
});
//Download csv
$('#csvButton').click(function(){
$('.csvButton').trigger('click');
});
//Download excelButton
$('#excelButton').click(function(){
$('.excelButton').trigger('click');
});
//Download pdf
$('#pdfButton').click(function(){
$('.pdfButton').trigger('click');
});
//Download printButton
$('#printButton').click(function(){
$('.printButton').trigger('click');
});
var id = $('.table-responsive .dataTables_filter').attr('id');
$('#'+id+' label').append('<a class="reset-data" id="input-sm-reset" href="javascript:void(0)"><i class="fa fa-times"></i></a>');
$(document).on('click', "#"+id+" label #input-sm-reset", function(){
dataTable.fnFilter('');
});
}(dataTable));
});
</script>
@endsection

0 comments on commit 70f90f6

Please sign in to comment.