"use strict"; // Class definition var KTAppsEducationSchoolTeacher = function() { // Private functions // basic demo var _demo = function() { var datatable = $('#kt_datatable').KTDatatable({ // datasource definition data: { type: 'remote', source: { read: { url: HOST_URL + '/api/datatables/demos/default.php', }, }, pageSize: 10, // display 20 records per page serverPaging: true, serverFiltering: true, serverSorting: true, }, // layout definition layout: { scroll: false, // enable/disable datatable scroll both horizontal and vertical when needed. footer: false, // display/hide footer }, // column sorting sortable: true, // enable pagination pagination: true, // columns definition columns: [ { field: 'CompanyName', title: 'Student', width: 250, template: function(data) { var number = KTUtil.getRandomInt(1, 10); var avatarsGirl = { 1: {'file': '002-girl.svg'}, 2: {'file': '003-girl-1.svg'}, 3: {'file': '006-girl-3.svg'}, 4: {'file': '012-girl-5.svg'}, 5: {'file': '013-girl-6.svg'}, 6: {'file': '019-girl-10.svg'}, 7: {'file': '020-girl-11.svg'}, 8: {'file': '030-girl-17.svg'}, 9: {'file': '037-girl-20.svg'}, 10: {'file': '039-girl-21.svg'} }; var avatarsBoy = { 1: {'file': '001-boy.svg'}, 2: {'file': '004-boy-1.svg'}, 3: {'file': '011-boy-5.svg'}, 4: {'file': '021-boy-8.svg'}, 5: {'file': '032-boy-13.svg'}, 6: {'file': '035-boy-15.svg'}, 7: {'file': '040-boy-17.svg'}, 8: {'file': '045-boy-20.svg'}, 9: {'file': '049-boy-22.svg'}, 10: {'file': '048-boy-21.svg'} }; var user_img = ''; if (data.Gender == 'F') { user_img = avatarsGirl[number].file; } else { user_img = avatarsBoy[number].file; } var output = '
\
\
\ photo\
\
\
\
' + data.CompanyAgent + '
\ ' + data.CompanyEmail + '\
\
'; return output; } }, { field: 'FacultyAgent', title: 'Faculty', template: function(row) { var output = ''; var genreIndex1 = KTUtil.getRandomInt(1, 5); var genre = { 1: {'title': ', BA'}, 2: {'title': ', BSc'}, 3: {'title': ', PhD'}, 4: {'title': ', MS'}, 5: {'title': ', MA'}, }; output += '' + row.CompanyName + genre[genreIndex1].title + ''; return output; } }, { field: 'JoinedDate', title: 'Joined', type: 'date', width: 100, format: 'MM/DD/YYYY', template: function(row) { var output = ''; output += '
' + row.ShipDate + '
'; return output; }, }, { field: 'Status', title: 'Status', autoHide: false, width: 100, // callback function support for column rendering template: function(row) { var index = KTUtil.getRandomInt(1, 3); var status = { 1: {'title': 'New', 'class': ' label-light-primary'}, 2: {'title': 'Active', 'class': ' label-light-danger'}, 3: {'title': 'In-active', 'class': ' label-light-info'}, }; return '' + status[index].title + ''; }, }, { field: 'Actions', title: 'Actions', sortable: false, width: 130, overflow: 'visible', autoHide: false, template: function() { return '\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ '; }, }], }); $('#kt_datatable_search_status').on('change', function() { datatable.search($(this).val().toLowerCase(), 'Status'); }); $('#kt_datatable_search_type').on('change', function() { datatable.search($(this).val().toLowerCase(), 'Type'); }); //$('#kt_datatable_search_status, #kt_datatable_search_type').selectpicker(); }; return { // public functions init: function() { _demo(); }, }; }(); jQuery(document).ready(function() { KTAppsEducationSchoolTeacher.init(); });