diff --git a/catatan_rilis.md b/catatan_rilis.md
index c9c4931b..8d33b3cc 100644
--- a/catatan_rilis.md
+++ b/catatan_rilis.md
@@ -3,7 +3,7 @@ Di rilis ini, versi 2602.0.0 berisi penambahan dan perbaikan yang diminta penggu
#### Penambahan Fitur
1. [#933](https://github.com/OpenSID/OpenKab/issues/933) Penambahan fungsi filter data Belum Lengkap pada data presisi.
-
+2. [#934](https://github.com/OpenSID/OpenKab/issues/934) Implementasi Pengurutan (Sorting) di Halaman Statistik Data Presisi.
#### Perbaikan BUG
diff --git a/resources/views/presisi/statistik/adat.blade.php b/resources/views/presisi/statistik/adat.blade.php
index ba60e562..d0765dad 100644
--- a/resources/views/presisi/statistik/adat.blade.php
+++ b/resources/views/presisi/statistik/adat.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php b/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
index 9d069ff5..6e1c0049 100644
--- a/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
+++ b/resources/views/presisi/statistik/aktivitas-keagamaan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/jaminan-sosial.blade.php b/resources/views/presisi/statistik/jaminan-sosial.blade.php
index 12cf7472..51dc95f8 100644
--- a/resources/views/presisi/statistik/jaminan-sosial.blade.php
+++ b/resources/views/presisi/statistik/jaminan-sosial.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/kesehatan.blade.php b/resources/views/presisi/statistik/kesehatan.blade.php
index 098eae64..535d4d82 100644
--- a/resources/views/presisi/statistik/kesehatan.blade.php
+++ b/resources/views/presisi/statistik/kesehatan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/ketenagakerjaan.blade.php b/resources/views/presisi/statistik/ketenagakerjaan.blade.php
index 55dc3ea1..7cf9a887 100644
--- a/resources/views/presisi/statistik/ketenagakerjaan.blade.php
+++ b/resources/views/presisi/statistik/ketenagakerjaan.blade.php
@@ -5,7 +5,7 @@
@section('title', 'Data Statistik')
@section('content_header')
-
Data Statistik {{ $judul }}
+
Data Statistik {{ $judul }}
@stop
@section('content')
@@ -35,8 +35,8 @@
@@ -107,7 +107,7 @@
let nama_desa = `{{ session('desa.nama_desa') }}`;
let kategori = `{{ strtolower($judul) }}`;
let default_id = null;
- document.addEventListener("DOMContentLoaded", function(event) {
+ document.addEventListener("DOMContentLoaded", function (event) {
const header = @include('layouts.components.header_bearer_api_gabungan');
@@ -119,21 +119,21 @@
url: urlKategoriStatistik.href,
headers: header,
method: 'get',
- success: function(response) {
+ success: function (response) {
var daftarKategoriStatistik = response.data[0]['attributes']
var html = ''
- Object.keys(daftarKategoriStatistik).forEach(function(index) {
+ Object.keys(daftarKategoriStatistik).forEach(function (index) {
var id = index;
var nama = daftarKategoriStatistik[index];
html += `
-
-
- ${nama}
-
-
- `
+
+
+ ${nama}
+
+
+ `
});
$('#daftar-statistik').html(html)
@@ -141,7 +141,7 @@
}
});
- $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('mouseenter', '.pilih-kategori > a', function () {
$(this).css('cursor', 'pointer')
});
@@ -149,8 +149,8 @@
function createExportCaption(categoryName, options = {}) {
const {
includeDate = true,
- includeLocation = true,
- customTitle = null,
+ includeLocation = true,
+ customTitle = null,
} = options;
var caption = {
@@ -293,20 +293,20 @@ function exportToExcel() {
return result;
}
- $('#export-excel').on('click', function() {
+ $('#export-excel').on('click', function () {
console.log('Export button clicked');
exportToExcel();
});
- $('#btn-grafik').on('click', function() {
+ $('#btn-grafik').on('click', function () {
$("#pie-statistik").collapse('hide');
});
- $('#btn-pie').on('click', function() {
+ $('#btn-pie').on('click', function () {
$("#grafik-statistik").collapse('hide')
});
- $('#daftar-statistik').on('click', '.pilih-kategori > a', function() {
+ $('#daftar-statistik').on('click', '.pilih-kategori > a', function () {
var id = $(this).data('id')
$('.pilih-kategori > a').removeClass('active')
@@ -331,7 +331,10 @@ function exportToExcel() {
processing: true,
serverSide: true,
autoWidth: false,
- ordering: false,
+ ordering: true,
+ order: [
+ [2, 'desc']
+ ],
searching: false,
deferLoading: 0,
paging: false,
@@ -340,15 +343,18 @@ function exportToExcel() {
url: urlStatistik.href,
headers: header,
method: 'get',
- data: function(row) {
+ data: function (row) {
return {
-
+ "sort": (row.order[0]?.dir === "asc" ? "" : "-") + row.columns[row
+ .order[0]
+ ?.column]
+ ?.name
};
},
- dataSrc: function(json) {
+ dataSrc: function (json) {
if (json.data && json.data.length > 0) {
data_grafik = [];
- json.data.forEach(function(item, index) {
+ json.data.forEach(function (item, index) {
data_grafik.push({
nama: item.attributes.nilai,
jumlah: item.attributes.jumlah
@@ -364,21 +370,22 @@ function exportToExcel() {
},
},
columnDefs: [{
- targets: '_all',
- className: 'text-nowrap',
- },
- {
- targets: [2],
- className: 'dt-body-right',
- },
+ targets: '_all',
+ className: 'text-nowrap',
+ },
+ {
+ targets: [2],
+ className: 'dt-body-right',
+ },
],
columns: [{
data: null,
- render: function(data, type, row, meta) {
+ orderable: false,
+ render: function (data, type, row, meta) {
return meta.row + 1;
}
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
if (nilai !== 'JUMLAH' && nilai !== 'BELUM MENGISI' && nilai !==
@@ -397,8 +404,9 @@ className: 'dt-body-right',
return nilai;
},
+ orderable: false,
}, {
- data: function(data) {
+ data: function (data) {
const nilai = data.attributes?.nilai || data.id || '';
const jumlah = data.attributes?.jumlah || 0;
@@ -413,26 +421,28 @@ className: 'dt-body-right',
return jumlah;
},
+ orderable: true,
+ name: 'jumlah',
}]
});
- statistik.on('draw.dt', function() {
+ statistik.on('draw.dt', function () {
var dataTable = $('#tabel-data').DataTable();
var pageInfo = dataTable.page.info();
var recordsTotal = dataTable.data().count();
statistik.column(0, {
page: 'current'
- }).nodes().each(function(cell, i) {
+ }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1 + pageInfo.start;
});
});
- $('#filter').on('click', function(e) {
+ $('#filter').on('click', function (e) {
statistik.draw();
});
- $(document).on('click', '#reset', function(e) {
+ $(document).on('click', '#reset', function (e) {
e.preventDefault();
statistik.ajax.reload();
});
@@ -464,4 +474,4 @@ className: 'dt-body-right',
color: blue;
}
-@endpush
+@endpush
\ No newline at end of file
diff --git a/resources/views/presisi/statistik/pangan.blade.php b/resources/views/presisi/statistik/pangan.blade.php
index 0f604936..dc71fc90 100644
--- a/resources/views/presisi/statistik/pangan.blade.php
+++ b/resources/views/presisi/statistik/pangan.blade.php
@@ -9,355 +9,359 @@
@stop
@section('content')
-@include('partials.breadcrumbs')
-