Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
S
sidekick
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Privat - Marco Schmiedel
sidekick
Commits
fb536ce9
Commit
fb536ce9
authored
Jul 12, 2022
by
Kevin Yumang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SERV-2286 - datatable css + responsiveness
parent
e446df03
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
81 deletions
+92
-81
datatables.init.js
src/Views/Limitless/Datatable/Attachments/datatables.init.js
+74
-36
datatable.css
src/Views/Limitless/Datatable/datatable.css
+18
-45
No files found.
src/Views/Limitless/Datatable/Attachments/datatables.init.js
View file @
fb536ce9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
function
limitless_init_datatable
()
{
function
limitless_init_datatable
()
{
// counter for datatables
// counter for datatables
var
DatatableCounter
=
0
;
let
DatatableCounter
=
0
;
// scann for each datatable
// scann for each datatable
$
(
'
.LimitlessTable
'
).
each
(
function
()
{
$
(
'
.LimitlessTable
'
).
each
(
function
()
{
...
@@ -17,7 +17,7 @@ function limitless_init_datatable() {
...
@@ -17,7 +17,7 @@ function limitless_init_datatable() {
setTimeout
(
function
()
{
setTimeout
(
function
()
{
// reset counter for datatables
// reset counter for datatables
var
DatatableCounter
=
0
;
let
DatatableCounter
=
0
;
// scann for each datatable
// scann for each datatable
$
(
'
.LimitlessTable
'
).
each
(
function
()
{
$
(
'
.LimitlessTable
'
).
each
(
function
()
{
...
@@ -28,11 +28,11 @@ function limitless_init_datatable() {
...
@@ -28,11 +28,11 @@ function limitless_init_datatable() {
// element
// element
let
elementTable
=
$
(
this
);
let
elementTable
=
$
(
this
);
var
currentClass
=
elementTable
.
attr
(
'
class
'
);
let
currentClass
=
elementTable
.
attr
(
'
class
'
);
currentClass
=
currentClass
.
replace
(
'
LimitlessTable
'
,
''
);
currentClass
=
currentClass
.
replace
(
'
LimitlessTable
'
,
''
);
// create replacement
// create replacement
var
NewHtml
=
''
+
let
NewHtml
=
''
+
'
<div id="DatatableFader
'
+
DatatableCounter
+
'
" class="DatatableFader">
'
+
'
<div id="DatatableFader
'
+
DatatableCounter
+
'
" class="DatatableFader">
'
+
'
<table id="Datatable
'
+
DatatableCounter
+
'
" class="display table datatable
'
+
currentClass
+
'
">
'
+
'
<table id="Datatable
'
+
DatatableCounter
+
'
" class="display table datatable
'
+
currentClass
+
'
">
'
+
elementTable
.
html
()
+
elementTable
.
html
()
+
...
@@ -44,9 +44,9 @@ function limitless_init_datatable() {
...
@@ -44,9 +44,9 @@ function limitless_init_datatable() {
// render setup parameter
// render setup parameter
var
counter
=
0
;
let
counter
=
0
;
var
sort
=
[];
let
sort
=
[];
var
orderable
=
[];
let
orderable
=
[];
$
(
'
#Datatable
'
+
DatatableCounter
).
find
(
'
th
'
).
each
(
function
()
{
$
(
'
#Datatable
'
+
DatatableCounter
).
find
(
'
th
'
).
each
(
function
()
{
...
@@ -81,21 +81,20 @@ function limitless_init_datatable() {
...
@@ -81,21 +81,20 @@ function limitless_init_datatable() {
});
});
// rows
// rows
var
rows
=
elementTable
.
attr
(
'
rows
'
);
let
rows
=
elementTable
.
attr
(
'
rows
'
);
if
(
rows
==
undefined
)
{
if
(
rows
==
undefined
)
{
rows
=
10
;
rows
=
10
;
}
}
// check entry count
// check entry count
let
Complex
=
false
;
if
(
$
(
'
#Datatable
'
+
DatatableCounter
).
children
(
'
tbody
'
).
children
(
'
tr
'
).
length
>
rows
)
{
if
(
$
(
'
#Datatable
'
+
DatatableCounter
).
children
(
'
tbody
'
).
children
(
'
tr
'
).
length
>
rows
)
{
var
Complex
=
true
;
Complex
=
true
;
}
else
{
var
Complex
=
false
;
}
}
// export buttons
// export buttons
let
showExportButtons
=
elementTable
.
attr
(
'
exportable
'
)
!=
undefined
&&
(
elementTable
.
attr
(
'
exportable
'
)
==
"
true
"
||
elementTable
.
attr
(
'
exportable
'
)
==
true
);
let
showExportButtons
=
elementTable
.
attr
(
'
exportable
'
)
!=
undefined
&&
(
elementTable
.
attr
(
'
exportable
'
)
==
"
true
"
||
elementTable
.
attr
(
'
exportable
'
)
==
true
);
let
exportButtons
=
[
'
copy
'
,
'
csv
'
,
'
excel
'
,
'
pdf
'
,
'
print
'
]
;
let
exportButtons
=
setExportButtons
()
;
// Define the table control elements to appear on the page and in what order.
// Define the table control elements to appear on the page and in what order.
// https://datatables.net/reference/option/dom
// https://datatables.net/reference/option/dom
...
@@ -130,13 +129,23 @@ function limitless_init_datatable() {
...
@@ -130,13 +129,23 @@ function limitless_init_datatable() {
"
lengthMenu
"
:
lengthMenu
,
"
lengthMenu
"
:
lengthMenu
,
"
drawCallback
"
:
function
(
settings
)
{
"
drawCallback
"
:
function
(
settings
)
{
// calculate height for animation
var
height
=
$
(
'
#
'
+
settings
.
sTableId
).
parents
(
'
.dataTables_wrapper
'
).
first
().
height
()
+
10
;
setSelect2
();
setSelect2
();
animate
(
settings
);
}
});
});
},
300
);
}
function
animate
(
settings
)
{
// calculate height for animation
let
height
=
$
(
'
#
'
+
settings
.
sTableId
).
parents
(
'
.dataTables_wrapper
'
).
first
().
height
()
+
10
;
// get int from callback
// get int from callback
var
callbbackid
=
settings
.
sTableId
.
replace
(
/
[^\d
.
]
/g
,
''
);
let
callbbackid
=
settings
.
sTableId
.
replace
(
/
[^\d
.
]
/g
,
''
);
// remove loader
// remove loader
$
(
'
#DatatableLoader
'
+
callbbackid
).
remove
();
$
(
'
#DatatableLoader
'
+
callbbackid
).
remove
();
...
@@ -151,18 +160,47 @@ function limitless_init_datatable() {
...
@@ -151,18 +160,47 @@ function limitless_init_datatable() {
'
opacity
'
:
'
1
'
,
'
opacity
'
:
'
1
'
,
'
min-height
'
:
height
'
min-height
'
:
height
},
300
,
function
()
{
},
300
,
function
()
{
// fix height for responsible design
// fix height for responsible design
$
(
'
#DatatableFader
'
+
callbbackid
).
css
(
"
height
"
,
"
auto
"
);
$
(
'
#DatatableFader
'
+
callbbackid
).
css
(
"
height
"
,
"
auto
"
);
$
(
'
#DatatableFader
'
+
callbbackid
).
css
(
"
min-height
"
,
"
auto
"
);
$
(
'
#DatatableFader
'
+
callbbackid
).
css
(
"
min-height
"
,
"
auto
"
);
});
});
}
// modified default class of export buttons.
// https://datatables.net/reference/option/buttons.dom.button
function
setExportButtons
()
{
return
{
dom
:
{
button
:
{
tag
:
'
button
'
,
className
:
''
}
}
});
},
});
buttons
:
[
{
extend
:
'
copy
'
,
className
:
'
btn btn-light
'
},
{
extend
:
'
csv
'
,
className
:
'
btn btn-light
'
},
{
extend
:
'
excel
'
,
className
:
'
btn btn-light
'
},
{
extend
:
'
pdf
'
,
className
:
'
btn btn-light
'
},
{
extend
:
'
print
'
,
className
:
'
btn btn-light
'
},
]
};
},
300
);
}
}
// Select2 for length menu styling
// Select2 for length menu styling
...
...
src/Views/Limitless/Datatable/datatable.css
View file @
fb536ce9
/* HIGHLIGHT SORTED COLUMN */
table
.dataTable.display
>
tbody
>
tr
.odd
>
.sorting_1
{
table
.dataTable.display
>
tbody
>
tr
.odd
>
.sorting_1
{
box-shadow
:
inset
0
0
0
9999px
rgb
(
0
0
0
/
20%
);
box-shadow
:
inset
0
0
0
9999px
rgb
(
0
0
0
/
20%
);
}
}
...
@@ -6,52 +7,24 @@ table.dataTable.display>tbody>tr.even>.sorting_1 {
...
@@ -6,52 +7,24 @@ table.dataTable.display>tbody>tr.even>.sorting_1 {
box-shadow
:
inset
0
0
0
9999px
rgb
(
0
0
0
/
10%
);
box-shadow
:
inset
0
0
0
9999px
rgb
(
0
0
0
/
10%
);
}
}
/*.table.dataTable.no-footer {*/
/* border: 0px!important;*/
/*}*/
/*.DatatableSearch {*/
/* EXPORT BUTTONS */
/* border: 1px solid #888888;*/
.dt-buttons
.btn
{
/*}*/
margin-bottom
:
0.333em
;
}
/*.DatatableFilter {*/
/* border: 1px solid #888888;*/
/* margin: 5px;*/
/*}*/
/*.dataTable tbody td {*/
/* vertical-align: middle;*/
/* text-align: center;*/
/*}*/
/*.dataTable tbody td {*/
/* vertical-align: middle;*/
/* text-align: center;*/
/*}*/
/*.table thead:first-child tr:first-child th {*/
/* border-top: 1px solid #ddd;*/
/*}*/
/*.table thead th {*/
/* vertical-align: middle;*/
/* border-bottom: 1px solid #b7b7b7;*/
/*}*/
/*.dataTable thead th {*/
/* padding-right: 2.5rem;*/
/* font-weight: 500;*/
/* padding: .75rem 1.25rem;*/
/*}*/
/*.dataTable {*/
/* border-collapse: collapse!important;*/
/*}*/
/*.c8tableBody {*/
.dt-buttons
{
/* width: 100%;*/
margin-right
:
1.25rem
;
/* overflow-x: auto;*/
}
/*}*/
@media
screen
and
(
max-width
:
640px
)
{
div
.dt-buttons
{
margin-right
:
0
;
}
}
/*table.fixedHeader-floating{position:fixed !important;background-color:white}table.fixedHeader-floating.no-footer{border-bottom-width:0}table.fixedHeader-locked{position:absolute !important;background-color:white}@media print{table.fixedHeader-floating{display:none}}*/
@media
(
max-width
:
1180px
)
{
\ No newline at end of file
div
.dt-buttons
{
width
:
100%
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment