//[Data Table Javascript] //Project: Lion Admin - Responsive Admin Template //Primary use: Used only for the Data Table $(function () { "use strict"; $(document).ready(function () { var table = $('#project-table').DataTable({ "data": testdata.data, "searching": true, "paging": true, "info": true, select:"single", "columns": [ { "className": 'details-control', "orderable": false, "data": null, "defaultContent": '', "render": function () { return ''; }, width:"15px" }, { "data": "name" }, { "data": "status" }, { "data": "starts" }, { "data": "ends" }, { "data": "est" }, { "data": "contacts" }, { "data": "tracker" }, ], "order": [[1, 'asc']] }); // Add event listener for opening and closing details $('#project-table tbody').on('click', 'td.details-control', function () { var tr = $(this).closest('tr'); var tdi = tr.find("i.fa"); var row = table.row(tr); if (row.child.isShown()) { // This row is already open - close it row.child.hide(); tr.removeClass('shown'); tdi.first().removeClass('fa-minus-square'); tdi.first().addClass('fa-plus-square'); } else { // Open this row row.child(format(row.data())).show(); tr.addClass('shown'); tdi.first().removeClass('fa-plus-square'); tdi.first().addClass('fa-minus-square'); } }); table.on("user-select", function (e, dt, type, cell, originalEvent) { if ($(cell.node()).hasClass("details-control")) { e.preventDefault(); } }); }); function format(d){ // `d` is the original data object for the row return '' + ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
Project Title:'+d.name+'
Deadline:'+d.ends+'
Extra info:And any further details here (images etc)...
Comments:'+d.comments+'
Action:'+d.action+'
'; } var testdata = { "data": [ { "name": "Sharepoint Upgrade
Budget: 5,000", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-21-2017", "ends": "02-30-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "IT Room Renovation
Budget: 25,000", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-17-2017", "ends": "02-30-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Car Industry Studies
Budget: 1,000", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-8-2017", "ends": "03-03-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Update all forms
Budget: 2,000", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-12-2017", "ends": "03-15-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Preliminary studies of client intel
Budget: 3,500", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-13-2017", "ends": "06-20-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "AngularJS UI design and development
Budget: 5,000", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-9-2017", "ends": "08-01-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Phase 1: Modual implimentations
Budget: 7,000", "est": "
", "contacts": "
user
", "status": "Inactive", "tracker": "", "starts": "01-4-2017", "ends": "09-11-2019", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Phase 2: Beta testing
No budget was locked in", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-11-2017", "ends": "07-11-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Phase 3: Deploy to management
No budget was locked in", "est": "
", "contacts": "
useruser
", "status": "Active", "tracker": "", "starts": "01-19-2017", "ends": "08-30-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Prepare property management contracts
No budget was locked in", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-20-2017", "ends": "02-30-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Brick factory
Budget: 1,000", "est": "
", "contacts": "
", "status": "Active", "tracker": "", "starts": "01-25-2017", "ends": "03-03-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Upgrade to windows 8.1
Budget: 2,000", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-27-2017", "ends": "02-30-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Refurbish Architecture
Budget: 1,200", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-29-2017", "ends": "12-15-2019", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Create filters and directives
Budget: 15,000", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-6-2017", "ends": "11-09-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " }, { "name": "Publish to Wrapbootstrap
Budget: 4,000", "est": "
", "contacts": "
user
", "status": "Active", "tracker": "", "starts": "01-8-2017", "ends": "07-07-2018", "comments": "This is a blank comments area, used to add comments and keep notes", "action": " " } ] }; }); // End of use strict