"use strict"; // Class definition var KTDatatableAutoColumnHideDemo = 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, saveState: false, serverPaging: true, serverFiltering: true, serverSorting: true, }, layout: { scroll: false }, // column sorting sortable: true, pagination: true, search: { input: $('#kt_datatable_search_query'), key: 'generalSearch' }, // columns definition columns: [ { field: 'OrderID', title: 'آیدی', }, { field: 'Country', title: 'کشور', template: function(row) { return row.Country + ' ' + row.ShipCountry; }, }, { field: 'CompanyEmail', title: 'ایمیل', width: 'auto', }, { field: 'ShipDate', title: 'تاریخ', type: 'date', format: 'MM/DD/YYYY', }, { field: 'CompanyName', title: 'نام شرکت', width: 'auto', }, { field: 'ShipAddress', title: 'آدرس', }, { field: 'Website', title: 'وب سایت', }, { field: 'TotalPayment', title: 'پرداخت', }, { field: 'Notes', title: 'یادداشت', width: 300, }, { field: 'Status', title: 'وضعیت', // callback function support for column rendering template: function(row) { var status = { 1: {'title': 'در حال انجام', 'class': 'label-light-primary'}, 2: {'title': 'تحویل داده شده', 'class': ' label-light-danger'}, 3: {'title': 'لغو شده', 'class': ' label-light-primary'}, 4: {'title': 'موفق', 'class': ' label-light-success'}, 5: {'title': 'اطلاعات', 'class': ' label-light-info'}, 6: {'title': 'خطار', 'class': ' label-light-danger'}, 7: {'title': 'هشدار', 'class': ' label-light-warning'}, }; return '' + status[row.Status].title + ''; }, }, { field: 'Type', title: 'نوع', // callback function support for column rendering template: function(row) { var status = { 1: {'title': 'برخط', 'state': 'danger'}, 2: {'title': 'خرده فروشی', 'state': 'primary'}, 3: {'title': 'مستقیم', 'state': 'success'}, }; return '' + status[row.Type].title + ''; }, }, { field: 'Actions', title: 'عملیات', sortable: false, width: 125, 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() { KTDatatableAutoColumnHideDemo.init(); });