'use strict'; // Class definition var KTDefaultDatatableDemo = 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: 5, // display 20 records per page serverPaging: true, serverFiltering: true, serverSorting: true, }, // layout definition layout: { scroll: true, // enable/disable datatable scroll both horizontal and vertical when needed. minHeight: null, // datatable's body's fixed height footer: false, // display/hide footer }, // column sorting sortable: true, // toolbar toolbar: { // toolbar placement can be at top or bottom or both top and bottom repeated placement: ['bottom'], // toolbar items items: { // pagination pagination: { // page size select pageSizeSelect: [5, 10, 20, 30, 50], // display dropdown to select pagination size. -1 is used for "ALl" option }, }, }, search: { input: $('#kt_datatable_search_query'), key: 'generalSearch' }, // columns definition columns: [ { field: 'RecordID', title: '#', sortable: false, width: 30, type: 'number', selector: {class: 'checkbox'}, textAlign: 'center', }, { field: 'OrderID', title: 'Order ID', }, { field: 'Country', title: 'Country', template: function(row) { return row.Country + ' ' + row.ShipCountry; }, }, { field: 'ShipDate', title: 'Ship Date', type: 'date', format: 'MM/DD/YYYY', }, { field: 'CompanyName', title: 'Company Name', }, { field: 'Status', title: 'Status', // callback function support for column rendering template: function(row) { var status = { 1: {'title': 'Pending', 'class': 'label-light-primary'}, 2: {'title': 'Delivered', 'class': ' label-light-light-danger'}, 3: {'title': 'Canceled', 'class': ' label-light-primary'}, 4: {'title': 'Success', 'class': ' label-light-success'}, 5: {'title': 'Info', 'class': ' label-light-info'}, 6: {'title': 'Danger', 'class': ' label-light-danger'}, 7: {'title': 'Warning', 'class': ' label-light-warning'}, }; return '' + status[row.Status].title + ''; }, }, { field: 'Type', title: 'Type', autoHide: false, // callback function support for column rendering template: function(row) { var status = { 1: {'title': 'Online', 'state': 'danger'}, 2: {'title': 'Retail', 'state': 'primary'}, 3: {'title': 'Direct', 'state': 'success'}, }; return '' + status[row.Type].title + ''; }, }, { field: 'Actions', title: 'Actions', sortable: false, width: 125, overflow: 'visible', autoHide: false, template: function() { return '\