api code global jain
This commit is contained in:
159
public/js/pages/crud/ktdatatable/advanced/vertical.js
vendored
Normal file
159
public/js/pages/crud/ktdatatable/advanced/vertical.js
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
// Class definition
|
||||
|
||||
var KTDefaultDatatableDemo = function () {
|
||||
// Private functions
|
||||
|
||||
// basic demo
|
||||
var demo = function () {
|
||||
|
||||
var datatable = $('#kt_datatable').KTDatatable({
|
||||
data: {
|
||||
type: 'remote',
|
||||
source: {
|
||||
read: {
|
||||
url: HOST_URL + '/api/datatables/demos/default.php'
|
||||
}
|
||||
},
|
||||
pageSize: 20,
|
||||
serverPaging: true,
|
||||
serverFiltering: true,
|
||||
serverSorting: true
|
||||
},
|
||||
|
||||
layout: {
|
||||
scroll: true,
|
||||
height: 550,
|
||||
footer: false
|
||||
},
|
||||
|
||||
sortable: true,
|
||||
|
||||
filterable: false,
|
||||
|
||||
pagination: true,
|
||||
|
||||
search: {
|
||||
input: $('#kt_datatable_search_query')
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
field: 'RecordID',
|
||||
title: '#',
|
||||
sortable: false,
|
||||
width: 20,
|
||||
type: 'number',
|
||||
selector: false,
|
||||
textAlign: 'center',
|
||||
}, {
|
||||
field: 'OrderID',
|
||||
title: 'Order ID',
|
||||
}, {
|
||||
field: 'Country',
|
||||
title: 'Country',
|
||||
template: function(row) {
|
||||
return row.Country + ' ' + row.ShipCountry;
|
||||
},
|
||||
}, {
|
||||
field: 'CompanyEmail',
|
||||
width: 150,
|
||||
title: 'Email',
|
||||
}, {
|
||||
field: 'ShipAddress',
|
||||
title: 'Ship Address',
|
||||
}, {
|
||||
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-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 '<span class="label label-lg font-weight-bold' + status[row.Status].class + ' label-inline">' + status[row.Status].title + '</span>';
|
||||
},
|
||||
}, {
|
||||
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 '<span class="label label-' + status[row.Type].state + ' label-dot mr-2"></span><span class="font-weight-bold text-' + status[row.Type].state + '">' +
|
||||
status[row.Type].title + '</span>';
|
||||
},
|
||||
}, {
|
||||
field: 'Actions',
|
||||
title: 'Actions',
|
||||
sortable: false,
|
||||
width: 110,
|
||||
overflow: 'visible',
|
||||
autoHide: false,
|
||||
template: function() {
|
||||
return '\
|
||||
<div class="dropdown dropdown-inline">\
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" data-toggle="dropdown">\
|
||||
<i class="la la-cog"></i>\
|
||||
</a>\
|
||||
<div class="dropdown-menu dropdown-menu-sm dropdown-menu-right">\
|
||||
<ul class="nav nav-hoverable flex-column">\
|
||||
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-edit"></i><span class="nav-text">Edit Details</span></a></li>\
|
||||
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-leaf"></i><span class="nav-text">Update Status</span></a></li>\
|
||||
<li class="nav-item"><a class="nav-link" href="#"><i class="nav-icon la la-print"></i><span class="nav-text">Print</span></a></li>\
|
||||
</ul>\
|
||||
</div>\
|
||||
</div>\
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" title="Edit details">\
|
||||
<i class="la la-edit"></i>\
|
||||
</a>\
|
||||
<a href="javascript:;" class="btn btn-sm btn-clean btn-icon" title="Delete">\
|
||||
<i class="la la-trash"></i>\
|
||||
</a>\
|
||||
';
|
||||
},
|
||||
}],
|
||||
|
||||
});
|
||||
|
||||
$('#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 () {
|
||||
KTDefaultDatatableDemo.init();
|
||||
});
|
||||
Reference in New Issue
Block a user