add overflow-x:auto to fix table when on mobile display
This commit is contained in:
1 parent
6d882b78d1
commit
792d97712c
2 files changed
+54
-17
No files matched your search
+11
-1
@@ -62,12 +62,20 @@
|
|||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
gap: 10px;
|
||||||
|
/* Adds space between the link and the button */
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-item a {
|
.file-item a {
|
||||||
color: #333;
|
color: #333;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
/* These 3 lines fix the text overflow */
|
||||||
|
word-break: break-all;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* Allow the link to shrink so the button doesn't get pushed out */
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-item a:hover {
|
.file-item a:hover {
|
||||||
@@ -78,6 +86,8 @@
|
|||||||
.file-item button {
|
.file-item button {
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
/* Prevent the button from shrinking or wrapping */
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -130,7 +140,7 @@
|
|||||||
<button class="btn btn-primary btn-xs" onclick="openAddModal()"><i class="fa fa-plus"></i>
|
<button class="btn btn-primary btn-xs" onclick="openAddModal()"><i class="fa fa-plus"></i>
|
||||||
Tambah Penelitian</button>
|
Tambah Penelitian</button>
|
||||||
</header>
|
</header>
|
||||||
<div class="panel-body">
|
<div class="panel-body" style="overflow-x: auto;">
|
||||||
<table id="tablePenelitian" class="table table-striped table-bordered dt-responsive nowrap"
|
<table id="tablePenelitian" class="table table-striped table-bordered dt-responsive nowrap"
|
||||||
style="width:100%">
|
style="width:100%">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
+43
-16
@@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
@@ -30,10 +31,24 @@
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Custom style for file list inside table */
|
/* Custom style for file list inside table */
|
||||||
.file-list { list-style: none; padding: 0; margin: 0; }
|
.file-list {
|
||||||
.file-list li { margin-bottom: 3px; }
|
list-style: none;
|
||||||
.file-list a { color: #007bff; text-decoration: none; }
|
padding: 0;
|
||||||
.file-list a:hover { text-decoration: underline; }
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-list li {
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-list a {
|
||||||
|
color: #007bff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-list a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -43,7 +58,8 @@
|
|||||||
<a href="index.html" class="logo">Tugas RPL</a>
|
<a href="index.html" class="logo">Tugas RPL</a>
|
||||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span class="status online"></span></a>
|
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span
|
||||||
|
class="status online"></span></a>
|
||||||
<h5 class="name"><a href="profile.html">Tamu</a></h5>
|
<h5 class="name"><a href="profile.html">Tamu</a></h5>
|
||||||
<h5 class="position">Tamu</h5>
|
<h5 class="position">Tamu</h5>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +73,8 @@
|
|||||||
<!-- /.title -->
|
<!-- /.title -->
|
||||||
<ul class="menu js__accordion">
|
<ul class="menu js__accordion">
|
||||||
<li>
|
<li>
|
||||||
<a class="waves-effect" href="login.html"><i class="menu-icon fa fa-sign-in"></i><span>Login</span></a>
|
<a class="waves-effect" href="login.html"><i
|
||||||
|
class="menu-icon fa fa-sign-in"></i><span>Login</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
@@ -70,7 +87,8 @@
|
|||||||
|
|
||||||
<div class="fixed-navbar">
|
<div class="fixed-navbar">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<button type="button" class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
<button type="button"
|
||||||
|
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||||
<h1 class="page-title">Halaman Utama</h1>
|
<h1 class="page-title">Halaman Utama</h1>
|
||||||
<!-- /.page-title -->
|
<!-- /.page-title -->
|
||||||
</div>
|
</div>
|
||||||
@@ -92,12 +110,14 @@
|
|||||||
<div class="row small-spacing">
|
<div class="row small-spacing">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<header class="panel-heading" style="display: flex; justify-content: space-between; align-items: center;">
|
<header class="panel-heading"
|
||||||
|
style="display: flex; justify-content: space-between; align-items: center;">
|
||||||
<h4 class="box-title" style="margin: 0;">Daftar Penelitian Dosen</h4>
|
<h4 class="box-title" style="margin: 0;">Daftar Penelitian Dosen</h4>
|
||||||
</header>
|
</header>
|
||||||
<div class="panel-body">
|
<div class="panel-body" style="overflow-x: auto;">
|
||||||
<!-- DataTables will automatically add a search box here -->
|
<!-- DataTables will automatically add a search box here -->
|
||||||
<table id="tabelPenelitian" class="table table-striped table-bordered dt-responsive nowrap" width="100%">
|
<table id="tabelPenelitian" class="table table-striped table-bordered dt-responsive nowrap"
|
||||||
|
width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>No</th>
|
<th>No</th>
|
||||||
@@ -149,16 +169,18 @@
|
|||||||
<!-- ================= CUSTOM SCRIPT FOR INDEX ================= -->
|
<!-- ================= CUSTOM SCRIPT FOR INDEX ================= -->
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#tabelPenelitian').DataTable({
|
var table = $('#tabelPenelitian').DataTable({
|
||||||
"ajax": {
|
"ajax": {
|
||||||
"url": "/api/penelitian", // Fetch data from backend
|
"url": "/api/penelitian", // Fetch data from backend
|
||||||
"dataSrc": ""
|
"dataSrc": ""
|
||||||
},
|
},
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
// Auto increment number based on pagination
|
// Give it a class so we can easily find it later
|
||||||
"data": null,
|
"data": null,
|
||||||
|
"className": "row-number",
|
||||||
"render": function (data, type, row, meta) {
|
"render": function (data, type, row, meta) {
|
||||||
|
// Initial render (will be updated by the event listener below)
|
||||||
return meta.row + meta.settings._iDisplayStart + 1;
|
return meta.row + meta.settings._iDisplayStart + 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -168,7 +190,6 @@
|
|||||||
{
|
{
|
||||||
"data": "status_penelitian",
|
"data": "status_penelitian",
|
||||||
"render": function (data) {
|
"render": function (data) {
|
||||||
// Added colored badges just like in dosen.html
|
|
||||||
let badge = data === 'Berjalan' ? 'label-warning' : 'label-success';
|
let badge = data === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||||
return `<span class="label ${badge}">${data}</span>`;
|
return `<span class="label ${badge}">${data}</span>`;
|
||||||
}
|
}
|
||||||
@@ -176,10 +197,8 @@
|
|||||||
{
|
{
|
||||||
"data": "hasil_publikasi",
|
"data": "hasil_publikasi",
|
||||||
"render": function (data, type, row) {
|
"render": function (data, type, row) {
|
||||||
// Parse the JSON array of filenames safely
|
|
||||||
if (data) {
|
if (data) {
|
||||||
try {
|
try {
|
||||||
// Handle both string JSON and already parsed Arrays from the DB
|
|
||||||
const files = typeof data === 'string' ? JSON.parse(data) : data;
|
const files = typeof data === 'string' ? JSON.parse(data) : data;
|
||||||
|
|
||||||
if (Array.isArray(files) && files.length > 0) {
|
if (Array.isArray(files) && files.length > 0) {
|
||||||
@@ -198,9 +217,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"order": [[ 3, "desc" ]] // Sort by Year (descending) by default
|
"order": [[3, "asc"]] // Sort by Year (ascending) by default
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// THIS IS THE FIX: Update the "No" column every time the table is drawn (sorted, searched, paged)
|
||||||
|
table.on('order.dt search.dt draw.dt', function () {
|
||||||
|
table.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
|
||||||
|
cell.innerHTML = i + 1;
|
||||||
|
});
|
||||||
|
}).draw();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user