table imported

This commit is contained in:
Yogesh Ojha
2020-05-11 22:03:15 +05:30
parent 329a3e9da4
commit caebefef1d
3 changed files with 36 additions and 122 deletions
@@ -1,97 +0,0 @@
$(document).ready(function() {
/*
Column Filter
*/
cf = $('#column-filter').DataTable({
headerCallback:function(e, a, t, n, s) {
e.getElementsByTagName("th")[0].innerHTML='<label class="new-control new-checkbox checkbox-primary m-auto">\n<input type="checkbox" class="new-control-input chk-parent select-customers-info" id="customer-all-info">\n<span class="new-control-indicator"></span><span style="visibility:hidden">c</span>\n</label>'
},
columnDefs:[ {
targets:0, width:"30px", className:"", orderable:!1, render:function(e, a, t, n) {
return'<label class="new-control new-checkbox checkbox-primary" style="height: 21px; margin-bottom: 0; margin-right: 0">\n<input type="checkbox" class="new-control-input child-chk select-customers-info" id="customer-all-info">\n <span class="new-control-indicator"></span>\n</label>'
}
}],
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
});
multiCheck(cf);
/*
Individual Column Search
*/
// Setup - add a text input to each footer cell
$('#individual-col-search tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" class="form-control" placeholder="Search '+title+'" />' );
} );
// DataTable
var table = $('#individual-col-search').DataTable({
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
});
// Apply the search
table.columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
/*
Show Hide column
*/
var table = $('#show-hide-col').DataTable( {
"searching": false,
"scrollY": "283px",
"paging": false,
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
} );
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} );
@@ -0,0 +1,19 @@
$(document).ready(function() {
var table = $('#show-hide-col').DataTable( {
"searching": false,
"scrollY": "200px",
"paging": false,
"info": false,
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 7
} );
$('a.toggle-vis').on( 'click', function (e) {
e.preventDefault();
// Get the column API object
var column = table.column( $(this).attr('data-column') );
// Toggle the visibility
column.visible( ! column.visible() );
} );
} );
+17 -25
View File
@@ -30,23 +30,26 @@ Scan Engine
</div>
<div class="widget-content widget-content-area">
<div class="toggle-list">
<a class="btn toggle-vis mb-4 ml-2" data-column="0">Name</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="1">Position</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="2">Office</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="3">Age</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="4">Start date</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="5">Salary</a>
<div class="row">
<a class="btn toggle-vis mb-4 ml-2" data-column="1">Subdomain Discovery</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="2">Directory & Files Discovery</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="3">Subdomain Takeover</a>
</div>
<div class="row">
<a class="btn toggle-vis mb-4 ml-2" data-column="4">Parameter Discovery</a>
<a class="btn toggle-vis mb-4 ml-2" data-column="5">Port Scan</a>
</div>
</div>
<div class="table-responsive mb-4">
<table id="show-hide-col" class="table table-hover" style="width:100%">
<thead style="border-bottom: none;">
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th>Engine Name</th>
<th>Subdomain Discovery</th>
<th>Directory & Files Discovery</th>
<th>Subdomain Takeover</th>
<th>Parameter Discovery</th>
<th>Port Scan</th>
<th class="text-center">Action</th>
</tr>
</thead>
@@ -54,26 +57,15 @@ Scan Engine
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
<td>$320,800</td>
<td class="text-center">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x-circle table-cancel"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
@@ -87,5 +79,5 @@ Scan Engine
{% block page_level_script %}
<script src="{% static 'plugins/table/datatable/datatables.js' %}"></script>
<script src="{% static 'scanEngine/js/custom_scan_engine.js' %}"></script>
<script src="{% static 'scanEngine/js/custom_scan_engine_table.js' %}"></script>
{% endblock page_level_script %}