[BS5] Replace FooTable with jquery Datatables
This commit is contained in:
18694
data/web/js/build/011-datatables.js
Normal file
18694
data/web/js/build/011-datatables.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -127,32 +127,84 @@ jQuery(function($){
|
||||
});
|
||||
}
|
||||
function draw_admins() {
|
||||
ft_admins = FooTable.init('#adminstable', {
|
||||
"columns": [
|
||||
{"name":"chkbox","title":"","style":{"maxWidth":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
||||
{"sorted": true,"name":"usr","title":lang.username,"style":{"width":"250px"}},
|
||||
{"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"},"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
||||
{"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
||||
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"250px","width":"250px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
|
||||
],
|
||||
"rows": $.ajax({
|
||||
dataType: 'json',
|
||||
url: '/api/v1/get/admin/all',
|
||||
jsonp: false,
|
||||
error: function () {
|
||||
console.log('Cannot draw admin table');
|
||||
},
|
||||
success: function (data) {
|
||||
return process_table_data(data, 'adminstable');
|
||||
}
|
||||
}),
|
||||
"empty": lang.empty,
|
||||
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
|
||||
"filtering": {"enabled": false},
|
||||
"state": {"enabled": true},
|
||||
"sorting": {"enabled": true},
|
||||
"toggleSelector": "table tbody span.footable-toggle"
|
||||
$.extend( $.fn.dataTable.defaults, {
|
||||
responsive: true
|
||||
});
|
||||
|
||||
$('#adminstable').DataTable({
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
language: lang_datatables,
|
||||
ajax: {
|
||||
type: "GET",
|
||||
url: "/api/v1/get/admin/all",
|
||||
dataSrc: function(json){
|
||||
return json;
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: lang.username,
|
||||
data: 'username',
|
||||
},
|
||||
{
|
||||
title: "TFA",
|
||||
data: 'tfa_active',
|
||||
render: function (data, type) {
|
||||
if(data == 1) return '<i class="bi bi-check-lg"></i>';
|
||||
else return '<i class="bi bi-x-lg"></i>'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: lang.active,
|
||||
data: 'active',
|
||||
render: function (data, type) {
|
||||
if(data == 1) return '<i class="bi bi-check-lg"></i>';
|
||||
else return '<i class="bi bi-x-lg"></i>'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: lang.action,
|
||||
data: null,
|
||||
render: function (data, type) {
|
||||
return `<div class="btn-group">
|
||||
<a href="/edit/admin/admin" class="btn btn-xs btn-xs-half btn-secondary">
|
||||
<i class="bi bi-pencil-fill"></i> Bearbeiten
|
||||
</a>
|
||||
<a href="#" data-action="delete_selected" data-id="single-admin" data-api-url="delete/admin" data-item="admin" class="btn btn-xs btn-xs-half btn-danger">
|
||||
<i class="bi bi-trash"></i> Entfernen
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
},
|
||||
]
|
||||
});
|
||||
// ft_admins = FooTable.init('#adminstable', {
|
||||
// "columns": [
|
||||
// {"name":"chkbox","title":"","style":{"maxWidth":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
||||
// {"sorted": true,"name":"usr","title":lang.username,"style":{"width":"250px"}},
|
||||
// {"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"},"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
||||
// {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
||||
// {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"250px","width":"250px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
|
||||
// ],
|
||||
// "rows": $.ajax({
|
||||
// dataType: 'json',
|
||||
// url: '/api/v1/get/admin/all',
|
||||
// jsonp: false,
|
||||
// error: function () {
|
||||
// console.log('Cannot draw admin table');
|
||||
// },
|
||||
// success: function (data) {
|
||||
// return process_table_data(data, 'adminstable');
|
||||
// }
|
||||
// }),
|
||||
// "empty": lang.empty,
|
||||
// "paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
|
||||
// "filtering": {"enabled": false},
|
||||
// "state": {"enabled": true},
|
||||
// "sorting": {"enabled": true},
|
||||
// "toggleSelector": "table tbody span.footable-toggle"
|
||||
// });
|
||||
}
|
||||
function draw_fwd_hosts() {
|
||||
ft_forwardinghoststable = FooTable.init('#forwardinghoststable', {
|
||||
@@ -361,14 +413,15 @@ jQuery(function($){
|
||||
}
|
||||
return data
|
||||
};
|
||||
// Initial table drawings
|
||||
draw_domain_admins();
|
||||
// // Initial table drawings
|
||||
// draw_domain_admins();
|
||||
draw_admins();
|
||||
draw_fwd_hosts();
|
||||
draw_relayhosts();
|
||||
draw_oauth2_clients();
|
||||
draw_transport_maps();
|
||||
draw_queue();
|
||||
// draw_fwd_hosts();
|
||||
// draw_relayhosts();
|
||||
// draw_oauth2_clients();
|
||||
// draw_transport_maps();
|
||||
// draw_queue();
|
||||
|
||||
|
||||
$('body').on('click', 'span.footable-toggle', function () {
|
||||
event.stopPropagation();
|
||||
|
Reference in New Issue
Block a user