NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DataTables Örneği</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- DataTables CSS -->
<link href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<!-- DataTables Buttons CSS -->
<link href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap5.min.css" rel="stylesheet">
<!-- DataTables Select CSS -->
<link href="https://cdn.datatables.net/select/1.3.3/css/select.bootstrap5.min.css" rel="stylesheet">
<style>
#myTable {
width: 100%;
border-collapse: separate;
border-spacing: 0;
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
#myTable thead {
background-color: #f8f9fa;
}
#myTable th, #myTable td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
#myTable tbody tr:last-child td {
border-bottom: none;
}
#myTable tbody tr:hover {
background-color: #f5f5f5;
}
.table-controls {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.table-controls .dataTables_length {
margin-right: 15px;
}
.table-controls .dataTables_filter {
margin-right: 15px;
}
.table-controls .dt-buttons {
display: flex;
}
.table-controls .dt-buttons .btn {
margin-right: 5px;
}
.column-filter {
width: 100%;
padding: 5px;
margin-top: 5px;
box-sizing: border-box;
}
#columnToggle {
margin-bottom: 15px;
}
#columnToggle label {
margin-right: 10px;
}
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 300px;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.cb-dropdown-wrap {
position: relative;
}
.cb-dropdown {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
max-height: 300px;
overflow-y: auto;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.cb-dropdown li {
padding: 5px 10px;
}
.cb-dropdown li.active {
background-color: #f5f5f5;
}
.cb-dropdown-wrap.active .cb-dropdown {
display: block;
}
.filter-icon {
cursor: pointer;
margin-left: 5px;
}
</style>
</head>
<body>
<div class="container mt-5">
<div id="columnToggle">
<h5>Sütunları Göster/Gizle:</h5>
</div>
<div class="table-controls">
<div class="dataTables_length"></div>
<div class="dataTables_filter"></div>
<div class="dt-buttons"></div>
</div>
<!-- Add these buttons for saving and loading layouts -->
<div class="mb-3">
<button id="saveLayout" class="btn btn-primary">Düzeni Kaydet</button>
<button id="loadLayout" class="btn btn-secondary">Düzeni Yükle</button>
</div>
<table id="myTable" class="table table-striped">
<thead>
<tr>
<th>Ad</th>
<th>Pozisyon</th>
<th>Ofis</th>
<th>Yaş</th>
<th>Başlangıç tarihi</th>
<th>Maaş</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ahmet Yılmaz</td>
<td>Sistem Mimarı</td>
<td>İstanbul</td>
<td>61</td>
<td>2011/04/25</td>
<td>₺320.800</td>
</tr>
<tr>
<td>Ayşe Demir</td>
<td>Muhasebeci</td>
<td>Ankara</td>
<td>63</td>
<td>2011/07/25</td>
<td>₺170.750</td>
</tr>
<tr>
<td>Mehmet Kaya</td>
<td>Yazılım Geliştirici</td>
<td>İzmir</td>
<td>35</td>
<td>2015/03/12</td>
<td>₺250.000</td>
</tr>
<tr>
<td>Zeynep Şahin</td>
<td>Pazarlama Uzmanı</td>
<td>Bursa</td>
<td>29</td>
<td>2018/09/01</td>
<td>₺180.000</td>
</tr>
<tr>
<td>Ali Öztürk</td>
<td>İnsan Kaynakları Müdürü</td>
<td>Antalya</td>
<td>45</td>
<td>2010/11/15</td>
<td>₺280.500</td>
</tr>
<tr>
<td>Fatma Çelik</td>
<td>Grafik Tasarımcı</td>
<td>Eskişehir</td>
<td>27</td>
<td>2019/06/20</td>
<td>₺160.000</td>
</tr>
<tr>
<td>Mustafa Aydın</td>
<td>Veri Analisti</td>
<td>Adana</td>
<td>32</td>
<td>2017/02/08</td>
<td>₺210.000</td>
</tr>
<tr>
<td>Elif Yıldız</td>
<td>Müşteri İlişkileri Yöneticisi</td>
<td>Samsun</td>
<td>38</td>
<td>2014/08/30</td>
<td>₺190.000</td>
</tr>
<tr>
<td>Hasan Korkmaz</td>
<td>Finans Direktörü</td>
<td>Kayseri</td>
<td>52</td>
<td>2009/12/01</td>
<td>₺350.000</td>
</tr>
<tr>
<td>Selin Arslan</td>
<td>Proje Yöneticisi</td>
<td>Trabzon</td>
<td>41</td>
<td>2013/05/17</td>
<td>₺240.000</td>
</tr>
<tr>
<td>Emre Güneş</td>
<td>Satış Temsilcisi</td>
<td>Gaziantep</td>
<td>33</td>
<td>2016/10/05</td>
<td>₺175.000</td>
</tr>
<tr>
<td>Gizem Akın</td>
<td>Sosyal Medya Uzmanı</td>
<td>Denizli</td>
<td>26</td>
<td>2020/01/15</td>
<td>₺155.000</td>
</tr>
<tr>
<td>Okan Yılmaz</td>
<td>Ürün Müdürü</td>
<td>Konya</td>
<td>37</td>
<td>2015/07/22</td>
<td>₺230.000</td>
</tr>
<tr>
<td>Ceren Demir</td>
<td>İş Analisti</td>
<td>Mersin</td>
<td>30</td>
<td>2018/03/10</td>
<td>₺185.000</td>
</tr>
<tr>
<td>Burak Kaya</td>
<td>Ar-Ge Mühendisi</td>
<td>Eskişehir</td>
<td>34</td>
<td>2016/09/18</td>
<td>₺220.000</td>
</tr>
</tbody>
</table>
</div>

<!-- Save Layout Modal -->
<div id="saveLayoutModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2>Düzeni Kaydet</h2>
<input type="text" id="layoutName" placeholder="Düzen adı" class="form-control mb-3">
<button id="saveLayoutBtn" class="btn btn-primary">Kaydet</button>
</div>
</div>

<!-- Load Layout Modal -->
<div id="loadLayoutModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2>Düzeni Yükle</h2>
<select id="layoutSelect" class="form-select mb-3"></select>
<button id="loadLayoutBtn" class="btn btn-primary">Yükle</button>
</div>
</div>

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Bootstrap 5 JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/dataTables.bootstrap5.min.js"></script>
<!-- DataTables Buttons JS -->
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<!-- DataTables Select JS -->
<script src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script>

<script>
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#myTable thead tr').clone(true).appendTo('#myTable thead');
$('#myTable thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
$(this).html('<input type="text" class="column-filter" placeholder="Filtrele ' + title + '" />');

$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {
table
.column(i)
.search(this.value)
.draw();
}
});
});

var table = $('#myTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.24/i18n/Turkish.json'
},
pageLength: 10,
lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "Tümü"]],
ordering: true,
searching: true,
info: true,
paging: true,
responsive: true,
columnDefs: [
{ orderable: false, targets: -1 }
],
dom: '<"table-controls"Blf>rtip',
buttons: [
'copy',
{
extend: 'csv',
charset: 'UTF-8',
bom: true
},
'excel', 'pdf', 'print'
],
orderCellsTop: true,
fixedHeader: true,
initComplete: function() {
this.api().columns().every(function() {
var column = this;
var header = $(column.header());
var ddmenu = cbDropdown(header);

// Filtre ikonunu ekle
$('<span class="filter-icon">🔍</span>')
.appendTo(header)
.on('click', function(e) {
e.stopPropagation();
ddmenu.parent().toggleClass('active');
});

ddmenu.on('click', function(e) {
e.stopPropagation();
});

ddmenu.on('change', ':checkbox', function() {
var active;
var vals = $(':checked', ddmenu).map(function(index, element) {
active = true;
return $.fn.dataTable.util.escapeRegex($(element).val());
}).toArray().join('|');

column
.search(vals.length > 0 ? '^(' + vals + ')$' : '', true, false)
.draw();

// Highlight the current item if selected.
if (this.checked) {
$(this).closest('li').addClass('active');
} else {
$(this).closest('li').removeClass('active');
}

// Highlight the current filter if selected.
var active2 = ddmenu.parent().is('.active');
if (active && !active2) {
ddmenu.parent().addClass('active');
} else if (!active && active2) {
ddmenu.parent().removeClass('active');
}
});

column.data().unique().sort().each(function(d, j) {
var $label = $('<label>'),
$text = $('<span>', {
text: d
}),
$cb = $('<input>', {
type: 'checkbox',
value: d
});

$cb.appendTo($label);
$text.appendTo($label);

ddmenu.append($('<li>').append($label));
});
});
}
});

// Add column visibility toggle
table.columns().every(function (index) {
var column = this;
var title = $(column.header()).text();
var checkboxId = 'toggle-' + index;

$('#columnToggle').append(
'<label for="' + checkboxId + '">' +
'<input type="checkbox" id="' + checkboxId + '" checked="checked" /> ' +
title +
'</label>'
);

$('#' + checkboxId).on('change', function () {
column.visible($(this).prop('checked'));
});
});

// Save layout function
$('#saveLayout').on('click', function() {
$('#saveLayoutModal').css('display', 'block');
});

$('#saveLayoutBtn').on('click', function() {
var layoutName = $('#layoutName').val();
if (layoutName) {
var columnsState = table.columns().visible().toArray();
var layouts = JSON.parse(localStorage.getItem('tableLayouts') || '{}');
layouts[layoutName] = columnsState;
localStorage.setItem('tableLayouts', JSON.stringify(layouts));
$('#saveLayoutModal').css('display', 'none');
$('#layoutName').val('');
updateLayoutDropdown();
}
});

// Load layout function
$('#loadLayout').on('click', function() {
updateLayoutDropdown();
$('#loadLayoutModal').css('display', 'block');
});

$('#loadLayoutBtn').on('click', function() {
var selectedLayout = $('#layoutSelect').val();
if (selectedLayout) {
var layouts = JSON.parse(localStorage.getItem('tableLayouts') || '{}');
var columnsState = layouts[selectedLayout];
table.columns().every(function (index) {
var column = this;
column.visible(columnsState[index]);
$('#toggle-' + index).prop('checked', columnsState[index]);
});
table.columns.adjust().draw(false);
$('#loadLayoutModal').css('display', 'none');
}
});

// Close modal when clicking on <span> (x)
$('.close').on('click', function() {
$(this).closest('.modal').css('display', 'none');
});

// Close modal when clicking outside of it
$(window).on('click', function(event) {
if ($(event.target).hasClass('modal')) {
$('.modal').css('display', 'none');
}
});

function updateLayoutDropdown() {
var layouts = JSON.parse(localStorage.getItem('tableLayouts') || '{}');
var $select = $('#layoutSelect');
$select.empty();
$.each(layouts, function(name, state) {
$select.append($('<option></option>').attr('value', name).text(name));
});
}

function cbDropdown(column) {
return $('<ul>', {
'class': 'cb-dropdown'
}).appendTo($('<div>', {
'class': 'cb-dropdown-wrap'
}).appendTo(column));
}

// Dropdown'ları kapatmak için belge üzerine tıklama olayı ekle
$(document).on('click', function() {
$('.cb-dropdown-wrap').removeClass('active');
});
});
</script>
</body>
</html>
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.