Primer Commit
This commit is contained in:
25
dist/js/pages/datatable/German.json
vendored
Normal file
25
dist/js/pages/datatable/German.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
{
|
||||
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
|
||||
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"sInfoEmpty": "0 bis 0 von 0 Einträgen",
|
||||
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
|
||||
"sInfoPostFix": "",
|
||||
"sInfoThousands": ".",
|
||||
"sLengthMenu": "_MENU_ Einträge anzeigen",
|
||||
"sLoadingRecords": "Wird geladen...",
|
||||
"sProcessing": "Bitte warten...",
|
||||
"sSearch": "Suchen",
|
||||
"sZeroRecords": "Keine Einträge vorhanden.",
|
||||
"oPaginate": {
|
||||
"sFirst": "Erste",
|
||||
"sPrevious": "Zurück",
|
||||
"sNext": "Nächste",
|
||||
"sLast": "Letzte"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
|
||||
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
|
||||
}
|
||||
}
|
||||
516
dist/js/pages/datatable/data.json
vendored
Normal file
516
dist/js/pages/datatable/data.json
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Tiger Nixon",
|
||||
"position": "System Architect",
|
||||
"salary": "$320,800",
|
||||
"start_date": "2011/04/25",
|
||||
"office": "Edinburgh",
|
||||
"extn": "5421"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"name": "Garrett Winters",
|
||||
"position": "Accountant",
|
||||
"salary": "$170,750",
|
||||
"start_date": "2011/07/25",
|
||||
"office": "Tokyo",
|
||||
"extn": "8422"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"name": "Ashton Cox",
|
||||
"position": "Junior Technical Author",
|
||||
"salary": "$86,000",
|
||||
"start_date": "2009/01/12",
|
||||
"office": "San Francisco",
|
||||
"extn": "1562"
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"name": "Cedric Kelly",
|
||||
"position": "Senior Javascript Developer",
|
||||
"salary": "$433,060",
|
||||
"start_date": "2012/03/29",
|
||||
"office": "Edinburgh",
|
||||
"extn": "6224"
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"name": "Airi Satou",
|
||||
"position": "Accountant",
|
||||
"salary": "$162,700",
|
||||
"start_date": "2008/11/28",
|
||||
"office": "Tokyo",
|
||||
"extn": "5407"
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"name": "Brielle Williamson",
|
||||
"position": "Integration Specialist",
|
||||
"salary": "$372,000",
|
||||
"start_date": "2012/12/02",
|
||||
"office": "New York",
|
||||
"extn": "4804"
|
||||
},
|
||||
{
|
||||
"id": "7",
|
||||
"name": "Herrod Chandler",
|
||||
"position": "Sales Assistant",
|
||||
"salary": "$137,500",
|
||||
"start_date": "2012/08/06",
|
||||
"office": "San Francisco",
|
||||
"extn": "9608"
|
||||
},
|
||||
{
|
||||
"id": "8",
|
||||
"name": "Rhona Davidson",
|
||||
"position": "Integration Specialist",
|
||||
"salary": "$327,900",
|
||||
"start_date": "2010/10/14",
|
||||
"office": "Tokyo",
|
||||
"extn": "6200"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"name": "Colleen Hurst",
|
||||
"position": "Javascript Developer",
|
||||
"salary": "$205,500",
|
||||
"start_date": "2009/09/15",
|
||||
"office": "San Francisco",
|
||||
"extn": "2360"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"name": "Sonya Frost",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$103,600",
|
||||
"start_date": "2008/12/13",
|
||||
"office": "Edinburgh",
|
||||
"extn": "1667"
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"name": "Jena Gaines",
|
||||
"position": "Office Manager",
|
||||
"salary": "$90,560",
|
||||
"start_date": "2008/12/19",
|
||||
"office": "London",
|
||||
"extn": "3814"
|
||||
},
|
||||
{
|
||||
"id": "12",
|
||||
"name": "Quinn Flynn",
|
||||
"position": "Support Lead",
|
||||
"salary": "$342,000",
|
||||
"start_date": "2013/03/03",
|
||||
"office": "Edinburgh",
|
||||
"extn": "9497"
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"name": "Charde Marshall",
|
||||
"position": "Regional Director",
|
||||
"salary": "$470,600",
|
||||
"start_date": "2008/10/16",
|
||||
"office": "San Francisco",
|
||||
"extn": "6741"
|
||||
},
|
||||
{
|
||||
"id": "14",
|
||||
"name": "Haley Kennedy",
|
||||
"position": "Senior Marketing Designer",
|
||||
"salary": "$313,500",
|
||||
"start_date": "2012/12/18",
|
||||
"office": "London",
|
||||
"extn": "3597"
|
||||
},
|
||||
{
|
||||
"id": "15",
|
||||
"name": "Tatyana Fitzpatrick",
|
||||
"position": "Regional Director",
|
||||
"salary": "$385,750",
|
||||
"start_date": "2010/03/17",
|
||||
"office": "London",
|
||||
"extn": "1965"
|
||||
},
|
||||
{
|
||||
"id": "16",
|
||||
"name": "Michael Silva",
|
||||
"position": "Marketing Designer",
|
||||
"salary": "$198,500",
|
||||
"start_date": "2012/11/27",
|
||||
"office": "London",
|
||||
"extn": "1581"
|
||||
},
|
||||
{
|
||||
"id": "17",
|
||||
"name": "Paul Byrd",
|
||||
"position": "Chief Financial Officer (CFO)",
|
||||
"salary": "$725,000",
|
||||
"start_date": "2010/06/09",
|
||||
"office": "New York",
|
||||
"extn": "3059"
|
||||
},
|
||||
{
|
||||
"id": "18",
|
||||
"name": "Gloria Little",
|
||||
"position": "Systems Administrator",
|
||||
"salary": "$237,500",
|
||||
"start_date": "2009/04/10",
|
||||
"office": "New York",
|
||||
"extn": "1721"
|
||||
},
|
||||
{
|
||||
"id": "19",
|
||||
"name": "Bradley Greer",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$132,000",
|
||||
"start_date": "2012/10/13",
|
||||
"office": "London",
|
||||
"extn": "2558"
|
||||
},
|
||||
{
|
||||
"id": "20",
|
||||
"name": "Dai Rios",
|
||||
"position": "Personnel Lead",
|
||||
"salary": "$217,500",
|
||||
"start_date": "2012/09/26",
|
||||
"office": "Edinburgh",
|
||||
"extn": "2290"
|
||||
},
|
||||
{
|
||||
"id": "21",
|
||||
"name": "Jenette Caldwell",
|
||||
"position": "Development Lead",
|
||||
"salary": "$345,000",
|
||||
"start_date": "2011/09/03",
|
||||
"office": "New York",
|
||||
"extn": "1937"
|
||||
},
|
||||
{
|
||||
"id": "22",
|
||||
"name": "Yuri Berry",
|
||||
"position": "Chief Marketing Officer (CMO)",
|
||||
"salary": "$675,000",
|
||||
"start_date": "2009/06/25",
|
||||
"office": "New York",
|
||||
"extn": "6154"
|
||||
},
|
||||
{
|
||||
"id": "23",
|
||||
"name": "Caesar Vance",
|
||||
"position": "Pre-Sales Support",
|
||||
"salary": "$106,450",
|
||||
"start_date": "2011/12/12",
|
||||
"office": "New York",
|
||||
"extn": "8330"
|
||||
},
|
||||
{
|
||||
"id": "24",
|
||||
"name": "Doris Wilder",
|
||||
"position": "Sales Assistant",
|
||||
"salary": "$85,600",
|
||||
"start_date": "2010/09/20",
|
||||
"office": "Sidney",
|
||||
"extn": "3023"
|
||||
},
|
||||
{
|
||||
"id": "25",
|
||||
"name": "Angelica Ramos",
|
||||
"position": "Chief Executive Officer (CEO)",
|
||||
"salary": "$1,200,000",
|
||||
"start_date": "2009/10/09",
|
||||
"office": "London",
|
||||
"extn": "5797"
|
||||
},
|
||||
{
|
||||
"id": "26",
|
||||
"name": "Gavin Joyce",
|
||||
"position": "Developer",
|
||||
"salary": "$92,575",
|
||||
"start_date": "2010/12/22",
|
||||
"office": "Edinburgh",
|
||||
"extn": "8822"
|
||||
},
|
||||
{
|
||||
"id": "27",
|
||||
"name": "Jennifer Chang",
|
||||
"position": "Regional Director",
|
||||
"salary": "$357,650",
|
||||
"start_date": "2010/11/14",
|
||||
"office": "Singapore",
|
||||
"extn": "9239"
|
||||
},
|
||||
{
|
||||
"id": "28",
|
||||
"name": "Brenden Wagner",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$206,850",
|
||||
"start_date": "2011/06/07",
|
||||
"office": "San Francisco",
|
||||
"extn": "1314"
|
||||
},
|
||||
{
|
||||
"id": "29",
|
||||
"name": "Fiona Green",
|
||||
"position": "Chief Operating Officer (COO)",
|
||||
"salary": "$850,000",
|
||||
"start_date": "2010/03/11",
|
||||
"office": "San Francisco",
|
||||
"extn": "2947"
|
||||
},
|
||||
{
|
||||
"id": "30",
|
||||
"name": "Shou Itou",
|
||||
"position": "Regional Marketing",
|
||||
"salary": "$163,000",
|
||||
"start_date": "2011/08/14",
|
||||
"office": "Tokyo",
|
||||
"extn": "8899"
|
||||
},
|
||||
{
|
||||
"id": "31",
|
||||
"name": "Michelle House",
|
||||
"position": "Integration Specialist",
|
||||
"salary": "$95,400",
|
||||
"start_date": "2011/06/02",
|
||||
"office": "Sidney",
|
||||
"extn": "2769"
|
||||
},
|
||||
{
|
||||
"id": "32",
|
||||
"name": "Suki Burks",
|
||||
"position": "Developer",
|
||||
"salary": "$114,500",
|
||||
"start_date": "2009/10/22",
|
||||
"office": "London",
|
||||
"extn": "6832"
|
||||
},
|
||||
{
|
||||
"id": "33",
|
||||
"name": "Prescott Bartlett",
|
||||
"position": "Technical Author",
|
||||
"salary": "$145,000",
|
||||
"start_date": "2011/05/07",
|
||||
"office": "London",
|
||||
"extn": "3606"
|
||||
},
|
||||
{
|
||||
"id": "34",
|
||||
"name": "Gavin Cortez",
|
||||
"position": "Team Leader",
|
||||
"salary": "$235,500",
|
||||
"start_date": "2008/10/26",
|
||||
"office": "San Francisco",
|
||||
"extn": "2860"
|
||||
},
|
||||
{
|
||||
"id": "35",
|
||||
"name": "Martena Mccray",
|
||||
"position": "Post-Sales support",
|
||||
"salary": "$324,050",
|
||||
"start_date": "2011/03/09",
|
||||
"office": "Edinburgh",
|
||||
"extn": "8240"
|
||||
},
|
||||
{
|
||||
"id": "36",
|
||||
"name": "Unity Butler",
|
||||
"position": "Marketing Designer",
|
||||
"salary": "$85,675",
|
||||
"start_date": "2009/12/09",
|
||||
"office": "San Francisco",
|
||||
"extn": "5384"
|
||||
},
|
||||
{
|
||||
"id": "37",
|
||||
"name": "Howard Hatfield",
|
||||
"position": "Office Manager",
|
||||
"salary": "$164,500",
|
||||
"start_date": "2008/12/16",
|
||||
"office": "San Francisco",
|
||||
"extn": "7031"
|
||||
},
|
||||
{
|
||||
"id": "38",
|
||||
"name": "Hope Fuentes",
|
||||
"position": "Secretary",
|
||||
"salary": "$109,850",
|
||||
"start_date": "2010/02/12",
|
||||
"office": "San Francisco",
|
||||
"extn": "6318"
|
||||
},
|
||||
{
|
||||
"id": "39",
|
||||
"name": "Vivian Harrell",
|
||||
"position": "Financial Controller",
|
||||
"salary": "$452,500",
|
||||
"start_date": "2009/02/14",
|
||||
"office": "San Francisco",
|
||||
"extn": "9422"
|
||||
},
|
||||
{
|
||||
"id": "40",
|
||||
"name": "Timothy Mooney",
|
||||
"position": "Office Manager",
|
||||
"salary": "$136,200",
|
||||
"start_date": "2008/12/11",
|
||||
"office": "London",
|
||||
"extn": "7580"
|
||||
},
|
||||
{
|
||||
"id": "41",
|
||||
"name": "Jackson Bradshaw",
|
||||
"position": "Director",
|
||||
"salary": "$645,750",
|
||||
"start_date": "2008/09/26",
|
||||
"office": "New York",
|
||||
"extn": "1042"
|
||||
},
|
||||
{
|
||||
"id": "42",
|
||||
"name": "Olivia Liang",
|
||||
"position": "Support Engineer",
|
||||
"salary": "$234,500",
|
||||
"start_date": "2011/02/03",
|
||||
"office": "Singapore",
|
||||
"extn": "2120"
|
||||
},
|
||||
{
|
||||
"id": "43",
|
||||
"name": "Bruno Nash",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$163,500",
|
||||
"start_date": "2011/05/03",
|
||||
"office": "London",
|
||||
"extn": "6222"
|
||||
},
|
||||
{
|
||||
"id": "44",
|
||||
"name": "Sakura Yamamoto",
|
||||
"position": "Support Engineer",
|
||||
"salary": "$139,575",
|
||||
"start_date": "2009/08/19",
|
||||
"office": "Tokyo",
|
||||
"extn": "9383"
|
||||
},
|
||||
{
|
||||
"id": "45",
|
||||
"name": "Thor Walton",
|
||||
"position": "Developer",
|
||||
"salary": "$98,540",
|
||||
"start_date": "2013/08/11",
|
||||
"office": "New York",
|
||||
"extn": "8327"
|
||||
},
|
||||
{
|
||||
"id": "46",
|
||||
"name": "Finn Camacho",
|
||||
"position": "Support Engineer",
|
||||
"salary": "$87,500",
|
||||
"start_date": "2009/07/07",
|
||||
"office": "San Francisco",
|
||||
"extn": "2927"
|
||||
},
|
||||
{
|
||||
"id": "47",
|
||||
"name": "Serge Baldwin",
|
||||
"position": "Data Coordinator",
|
||||
"salary": "$138,575",
|
||||
"start_date": "2012/04/09",
|
||||
"office": "Singapore",
|
||||
"extn": "8352"
|
||||
},
|
||||
{
|
||||
"id": "48",
|
||||
"name": "Zenaida Frank",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$125,250",
|
||||
"start_date": "2010/01/04",
|
||||
"office": "New York",
|
||||
"extn": "7439"
|
||||
},
|
||||
{
|
||||
"id": "49",
|
||||
"name": "Zorita Serrano",
|
||||
"position": "Software Engineer",
|
||||
"salary": "$115,000",
|
||||
"start_date": "2012/06/01",
|
||||
"office": "San Francisco",
|
||||
"extn": "4389"
|
||||
},
|
||||
{
|
||||
"id": "50",
|
||||
"name": "Jennifer Acosta",
|
||||
"position": "Junior Javascript Developer",
|
||||
"salary": "$75,650",
|
||||
"start_date": "2013/02/01",
|
||||
"office": "Edinburgh",
|
||||
"extn": "3431"
|
||||
},
|
||||
{
|
||||
"id": "51",
|
||||
"name": "Cara Stevens",
|
||||
"position": "Sales Assistant",
|
||||
"salary": "$145,600",
|
||||
"start_date": "2011/12/06",
|
||||
"office": "New York",
|
||||
"extn": "3990"
|
||||
},
|
||||
{
|
||||
"id": "52",
|
||||
"name": "Hermione Butler",
|
||||
"position": "Regional Director",
|
||||
"salary": "$356,250",
|
||||
"start_date": "2011/03/21",
|
||||
"office": "London",
|
||||
"extn": "1016"
|
||||
},
|
||||
{
|
||||
"id": "53",
|
||||
"name": "Lael Greer",
|
||||
"position": "Systems Administrator",
|
||||
"salary": "$103,500",
|
||||
"start_date": "2009/02/27",
|
||||
"office": "London",
|
||||
"extn": "6733"
|
||||
},
|
||||
{
|
||||
"id": "54",
|
||||
"name": "Jonas Alexander",
|
||||
"position": "Developer",
|
||||
"salary": "$86,500",
|
||||
"start_date": "2010/07/14",
|
||||
"office": "San Francisco",
|
||||
"extn": "8196"
|
||||
},
|
||||
{
|
||||
"id": "55",
|
||||
"name": "Shad Decker",
|
||||
"position": "Regional Director",
|
||||
"salary": "$183,000",
|
||||
"start_date": "2008/11/13",
|
||||
"office": "Edinburgh",
|
||||
"extn": "6373"
|
||||
},
|
||||
{
|
||||
"id": "56",
|
||||
"name": "Michael Bruce",
|
||||
"position": "Javascript Developer",
|
||||
"salary": "$183,000",
|
||||
"start_date": "2011/06/27",
|
||||
"office": "Singapore",
|
||||
"extn": "5384"
|
||||
},
|
||||
{
|
||||
"id": "57",
|
||||
"name": "Donna Snider",
|
||||
"position": "Customer Support",
|
||||
"salary": "$112,000",
|
||||
"start_date": "2011/01/25",
|
||||
"office": "New York",
|
||||
"extn": "4226"
|
||||
}]
|
||||
}
|
||||
204
dist/js/pages/datatable/datatable-advanced.init.js
vendored
Normal file
204
dist/js/pages/datatable/datatable-advanced.init.js
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
/*************************************************************************************/
|
||||
// -->Template Name: Bootstrap Press Admin
|
||||
// -->Author: Themedesigner
|
||||
// -->Email: niravjoshi87@gmail.com
|
||||
// -->File: datatable_advanced_init
|
||||
/*************************************************************************************/
|
||||
|
||||
//=============================================//
|
||||
// File export //
|
||||
//=============================================//
|
||||
$('#file_export').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
$('.buttons-copy, .buttons-csv, .buttons-print, .buttons-pdf, .buttons-excel').addClass('btn btn-primary mr-1');
|
||||
|
||||
//==================================================//
|
||||
// Show / hide columns dynamically //
|
||||
//==================================================//
|
||||
|
||||
var table = $('#show_hide_col').DataTable({
|
||||
"scrollY": "200px",
|
||||
"paging": false
|
||||
});
|
||||
|
||||
$('a.toggle-vis').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Get the column API object
|
||||
/*var column = table.column($(this).attr('data-column'));*/
|
||||
var column = $('#show_hide_col').dataTable().api().column($(this).attr('data-column'));
|
||||
// Toggle the visibility
|
||||
column.visible(!column.visible());
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Column rendering //
|
||||
//=============================================//
|
||||
$('#col_render').DataTable({
|
||||
"columnDefs": [{
|
||||
// The `data` parameter refers to the data for the cell (defined by the
|
||||
// `data` option, which defaults to the column being worked with, in
|
||||
// this case `data: 0`.
|
||||
"render": function(data, type, row) {
|
||||
return data + ' (' + row[3] + ')';
|
||||
},
|
||||
"targets": 0
|
||||
},
|
||||
{ "visible": false, "targets": [3] }
|
||||
]
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Row grouping //
|
||||
//=============================================//
|
||||
var table = $('#row_group').DataTable({
|
||||
"pageLength": 10,
|
||||
"columnDefs": [
|
||||
{ "visible": false, "targets": 2 }
|
||||
],
|
||||
"order": [
|
||||
[2, 'asc']
|
||||
],
|
||||
"displayLength": 25,
|
||||
"drawCallback": function(settings) {
|
||||
var api = this.api();
|
||||
var rows = api.rows({ page: 'current' }).nodes();
|
||||
var last = null;
|
||||
|
||||
api.column(2, { page: 'current' }).data().each(function(group, i) {
|
||||
if (last !== group) {
|
||||
$(rows).eq(i).before(
|
||||
'<tr class="group"><td colspan="5">' + group + '</td></tr>'
|
||||
);
|
||||
|
||||
last = group;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Order by the grouping
|
||||
//=============================================//
|
||||
$('#row_group tbody').on('click', 'tr.group', function() {
|
||||
var currentOrder = table.order()[0];
|
||||
if (currentOrder[0] === 2 && currentOrder[1] === 'asc') {
|
||||
table.order([2, 'desc']).draw();
|
||||
} else {
|
||||
table.order([2, 'asc']).draw();
|
||||
}
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Multiple table control element //
|
||||
//=============================================//
|
||||
$('#multi_control').DataTable({
|
||||
"dom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>'
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// DOM/jquery events //
|
||||
//=============================================//
|
||||
var table = $('#dom_jq_event').DataTable();
|
||||
|
||||
$('#dom_jq_event tbody').on('click', 'tr', function() {
|
||||
var data = table.row(this).data();
|
||||
alert('You clicked on ' + data[0] + '\'s row');
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Language File //
|
||||
//=============================================//
|
||||
$('#lang_file').DataTable({
|
||||
"language": {
|
||||
"url": "dist/js/pages/datatable/German.json"
|
||||
}
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Complex headers with column visibility //
|
||||
//=============================================//
|
||||
|
||||
$('#complex_head_col').DataTable({
|
||||
"columnDefs": [{
|
||||
"visible": false,
|
||||
"targets": -1
|
||||
}]
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Setting defaults //
|
||||
//=============================================//
|
||||
var defaults = {
|
||||
"searching": false,
|
||||
"ordering": false
|
||||
};
|
||||
|
||||
$('#setting_defaults').dataTable($.extend(true, {}, defaults, {}));
|
||||
|
||||
|
||||
|
||||
//=============================================//
|
||||
// Footer callback //
|
||||
//=============================================//
|
||||
$('#footer_callback').DataTable({
|
||||
"footerCallback": function(row, data, start, end, display) {
|
||||
var api = this.api(),
|
||||
data;
|
||||
|
||||
// Remove the formatting to get integer data for summation
|
||||
var intVal = function(i) {
|
||||
return typeof i === 'string' ?
|
||||
i.replace(/[\$,]/g, '') * 1 :
|
||||
typeof i === 'number' ?
|
||||
i : 0;
|
||||
};
|
||||
|
||||
// Total over all pages
|
||||
total = api
|
||||
.column(4)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return intVal(a) + intVal(b);
|
||||
}, 0);
|
||||
|
||||
// Total over this page
|
||||
pageTotal = api
|
||||
.column(4, { page: 'current' })
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return intVal(a) + intVal(b);
|
||||
}, 0);
|
||||
|
||||
// Update footer
|
||||
$(api.column(4).footer()).html(
|
||||
'$' + pageTotal + ' ( $' + total + ' total)'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Custom toolbar elements //
|
||||
//=============================================//
|
||||
|
||||
$('#custom_tool_ele').DataTable({
|
||||
"dom": '<"toolbar">frtip'
|
||||
});
|
||||
|
||||
$("div.toolbar").html('<b>Custom tool bar! Text/images etc.</b>');
|
||||
|
||||
|
||||
//=============================================//
|
||||
// Row created callback //
|
||||
//=============================================//
|
||||
$('#row_create_call').DataTable({
|
||||
"createdRow": function(row, data, index) {
|
||||
if (data[5].replace(/[\$,]/g, '') * 1 > 150000) {
|
||||
$('td', row).eq(5).addClass('highlight');
|
||||
}
|
||||
}
|
||||
});
|
||||
189
dist/js/pages/datatable/datatable-api.init.js
vendored
Normal file
189
dist/js/pages/datatable/datatable-api.init.js
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
/*************************************************************************************/
|
||||
// -->Template Name: Bootstrap Press Admin
|
||||
// -->Author: Themedesigner
|
||||
// -->Email: niravjoshi87@gmail.com
|
||||
// -->File: datatable_api_init
|
||||
/*************************************************************************************/
|
||||
|
||||
//==================================================//
|
||||
// Add row //
|
||||
//==================================================//
|
||||
var t = $('#t_add_row').DataTable();
|
||||
var counter = 1;
|
||||
|
||||
$('#addRow').on('click', function() {
|
||||
t.row.add([
|
||||
counter + '.1',
|
||||
counter + '.2',
|
||||
counter + '.3',
|
||||
counter + '.4',
|
||||
counter + '.5'
|
||||
]).draw(false);
|
||||
|
||||
counter++;
|
||||
});
|
||||
|
||||
// Automatically add a first row of data
|
||||
$('#addRow').click();
|
||||
|
||||
//==================================================//
|
||||
// Individual column searching (select inputs) //
|
||||
//==================================================//
|
||||
|
||||
$('.datatable-select-inputs').DataTable({
|
||||
initComplete: function() {
|
||||
this.api().columns().every(function() {
|
||||
var column = this;
|
||||
var select = $('<select><option value="">Select option</option></select>')
|
||||
.appendTo($(column.footer()).empty())
|
||||
.on('change', function() {
|
||||
var val = $.fn.dataTable.util.escapeRegex(
|
||||
$(this).val()
|
||||
);
|
||||
|
||||
column
|
||||
.search(val ? '^' + val + '$' : '', true, false)
|
||||
.draw();
|
||||
});
|
||||
|
||||
column.data().unique().sort().each(function(d, j) {
|
||||
select.append('<option value="' + d + '">' + d + '</option>');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//==================================================//
|
||||
// Individual column searching (text inputs) //
|
||||
//==================================================//
|
||||
// Setup - add a text input to each footer cell
|
||||
$('.text-inputs-searching tfoot th').each(function() {
|
||||
var title = $(this).text();
|
||||
$(this).html('<input type="text" placeholder="Search ' + title + '" />');
|
||||
});
|
||||
|
||||
// DataTable
|
||||
var tableSearching = $('.text-inputs-searching').DataTable();
|
||||
|
||||
// Apply the search
|
||||
tableSearching.columns().every(function() {
|
||||
var that = this;
|
||||
|
||||
$('input', this.footer()).on('keyup change', function() {
|
||||
if (that.search() !== this.value) {
|
||||
that
|
||||
.search(this.value)
|
||||
.draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
//==================================================//
|
||||
// Child rows (show extra / detailed information) //
|
||||
//==================================================//
|
||||
/* Formatting function for row details - modify as you need */
|
||||
function format(d) {
|
||||
// `d` is the original data object for the row
|
||||
return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
|
||||
'<tr>' +
|
||||
'<td>Full name:</td>' +
|
||||
'<td>' + d.name + '</td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Extension number:</td>' +
|
||||
'<td>' + d.extn + '</td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>Extra info:</td>' +
|
||||
'<td>And any further details here (images etc)...</td>' +
|
||||
'</tr>' +
|
||||
'</table>';
|
||||
}
|
||||
|
||||
//=============================================//
|
||||
// -- Child rows
|
||||
//=============================================//
|
||||
var tableChildRows = $('.show-child-rows').DataTable({
|
||||
"ajax": "dist/js/pages/datatable/data.json",
|
||||
"columns": [{
|
||||
"className": 'details-control',
|
||||
"orderable": false,
|
||||
"data": null,
|
||||
"defaultContent": ''
|
||||
},
|
||||
{ "data": "name" },
|
||||
{ "data": "position" },
|
||||
{ "data": "office" },
|
||||
{ "data": "salary" }
|
||||
],
|
||||
"order": [
|
||||
[1, 'asc']
|
||||
]
|
||||
});
|
||||
|
||||
//=============================================//
|
||||
// Add event listener for opening and closing details
|
||||
//=============================================//
|
||||
$('.show-child-rows tbody').on('click', 'td.details-control', function() {
|
||||
var tr = $(this).closest('tr');
|
||||
var row = tableChildRows.row(tr);
|
||||
|
||||
if (row.child.isShown()) {
|
||||
// This row is already open - close it
|
||||
row.child.hide();
|
||||
tr.removeClass('shown');
|
||||
} else {
|
||||
// Open this row
|
||||
row.child(format(row.data())).show();
|
||||
tr.addClass('shown');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//==================================================//
|
||||
// Row selection (multiple rows) //
|
||||
//==================================================//
|
||||
var table1 = $('#row_select').DataTable();
|
||||
|
||||
$('#row_select tbody').on('click', 'tr', function() {
|
||||
$(this).toggleClass('selected');
|
||||
});
|
||||
|
||||
$('#button').click(function() {
|
||||
alert(table1.rows('.selected').data().length + ' row(s) selected');
|
||||
});
|
||||
|
||||
//==================================================//
|
||||
// Form Inputs //
|
||||
//==================================================//
|
||||
|
||||
var table2 = $('#form_inputs').DataTable();
|
||||
|
||||
$('.inputs-submit').click(function() {
|
||||
var data = table2.$('input, select').serialize();
|
||||
alert(
|
||||
"The following data would have been submitted to the server: \n\n" +
|
||||
data.substr(0, 120) + '...'
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
||||
//==================================================//
|
||||
// Row selection and deletion (single row) //
|
||||
//==================================================//
|
||||
var table3 = $('#sing_row_del').DataTable();
|
||||
|
||||
$('#sing_row_del tbody').on('click', 'tr', function() {
|
||||
if ($(this).hasClass('selected')) {
|
||||
$(this).removeClass('selected');
|
||||
} else {
|
||||
table3.$('tr.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
}
|
||||
});
|
||||
|
||||
$('#delete-row').click(function() {
|
||||
table3.row('.selected').remove().draw(false);
|
||||
});
|
||||
111
dist/js/pages/datatable/datatable-basic.init.js
vendored
Normal file
111
dist/js/pages/datatable/datatable-basic.init.js
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/*************************************************************************************/
|
||||
// -->Template Name: Bootstrap Press Admin
|
||||
// -->Author: Themedesigner
|
||||
// -->Email: niravjoshi87@gmail.com
|
||||
// -->File: datatable_basic_init
|
||||
/*************************************************************************************/
|
||||
|
||||
/****************************************
|
||||
* Basic Table *
|
||||
****************************************/
|
||||
$('#zero_config').DataTable();
|
||||
|
||||
/****************************************
|
||||
* Default Order Table *
|
||||
****************************************/
|
||||
$('#default_order').DataTable({
|
||||
"order": [
|
||||
[3, "desc"]
|
||||
]
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* Multi-column Order Table *
|
||||
****************************************/
|
||||
$('#multi_col_order').DataTable({
|
||||
columnDefs: [{
|
||||
targets: [0],
|
||||
orderData: [0, 1]
|
||||
}, {
|
||||
targets: [1],
|
||||
orderData: [1, 0]
|
||||
}, {
|
||||
targets: [4],
|
||||
orderData: [4, 0]
|
||||
}]
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* Complex header Table *
|
||||
****************************************/
|
||||
$('#complex_header').DataTable();
|
||||
|
||||
/****************************************
|
||||
* DOM positioning Table *
|
||||
****************************************/
|
||||
$('#DOM_pos').DataTable({
|
||||
"dom": '<"top"i>rt<"bottom"flp><"clear">'
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* alternative pagination Table *
|
||||
****************************************/
|
||||
$('#alt_pagination').DataTable({
|
||||
"pagingType": "full_numbers"
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* vertical scroll Table *
|
||||
****************************************/
|
||||
$('#scroll_ver').DataTable({
|
||||
"scrollY": "300px",
|
||||
"scrollCollapse": true,
|
||||
"paging": false
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* vertical scroll,dynamic height Table *
|
||||
****************************************/
|
||||
$('#scroll_ver_dynamic_hei').DataTable({
|
||||
scrollY: '50vh',
|
||||
scrollCollapse: true,
|
||||
paging: false
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* horizontal scroll Table *
|
||||
****************************************/
|
||||
$('#scroll_hor').DataTable({
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* vertical & horizontal scroll Table *
|
||||
****************************************/
|
||||
$('#scroll_ver_hor').DataTable({
|
||||
"scrollY": 300,
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* Language - Comma decimal place Table *
|
||||
****************************************/
|
||||
$('#lang_comma_deci').DataTable({
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": "."
|
||||
}
|
||||
});
|
||||
|
||||
/****************************************
|
||||
* Language options Table *
|
||||
****************************************/
|
||||
$('#lang_opt').DataTable({
|
||||
"language": {
|
||||
"lengthMenu": "Display _MENU_ records per page",
|
||||
"zeroRecords": "Nothing found - sorry",
|
||||
"info": "Showing page _PAGE_ of _PAGES_",
|
||||
"infoEmpty": "No records available",
|
||||
"infoFiltered": "(filtered from _MAX_ total records)"
|
||||
}
|
||||
});
|
||||
BIN
dist/js/pages/datatable/details_close.png
vendored
Normal file
BIN
dist/js/pages/datatable/details_close.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 686 B |
BIN
dist/js/pages/datatable/details_open.png
vendored
Normal file
BIN
dist/js/pages/datatable/details_open.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 709 B |
Reference in New Issue
Block a user