table child update

This commit is contained in:
2025-12-05 15:40:37 +07:00
parent 8864811189
commit 3ea59c7ac7
3 changed files with 49 additions and 56 deletions
+4 -16
View File
@@ -4,9 +4,9 @@
Desc. : CSS Default Configuration
Created By : Siau Pheng ([email protected]).
Created Date : December 20th, 2007.
Last Modified : December 16th, 2023.
Last Modified : December 5th, 2025.
(c) 2009 - 2023, 3FONIA Software; WWW.3FONIA.COM.
(c) 2009 - 2025, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
@@ -75,20 +75,8 @@ table.dataTable.table-bordered th {
table.dataTable.table-bordered tr:last-child td {
border-bottom-width: 1px !important;
}
table.dataTable a.fon-tabel-dt i {
padding-top: 2px;
width: 1.5rem !important;
height: 1.5rem !important;
border: 0.15em solid white;
border-radius: .7em;
box-shadow: 0 0 0.2em #444;
background-color: #31b131;
}
table.dataTable tr.dt-hasChild a.fon-tabel-dt i {
background-color: #d33333;
}
table.dataTable a.fon-tabel-dt:hover i, table.dataTable tr.dt-hasChild a.fon-tabel-dt:hover i {
color: unset;
table.dataTable.table-hover tbody tr:has(td > div.fon-tabel-child):hover {
background-color: transparent;
}
div.dataTables_wrapper div.toolbar button {
font-size: unset;
+35 -34
View File
@@ -4,7 +4,7 @@
Desc. : JS - Fonia Custom Class v3
Created By : Siau Pheng ([email protected]).
Created Date : June 19th, 2009.
Last Modified : December 3rd, 2025.
Last Modified : December 4th, 2025.
(c) 2009 - 2025, 3FONIA Software; WWW.3FONIA.COM.
@@ -759,7 +759,7 @@ Request.JSONF = function(options){//oke
strAksi = '<input class="form-check-input" type="checkbox" id="'+ini.id+'_cbhead_'+val.field+'" value="'+val.avalue[1]+'">';
ChkField = val.field;
}
if (val.type == 'button') aTombol[val.icon] = val.label;
if ($.inArray(val.type,['button','button-dt'])!==-1) aTombol[val.icon] = [val.label, (val.type=='button'?0:1)];
});
strHead += '<th data-class-name="c">'+strAksi+'</th>';
aSortCol.push(null);
@@ -800,14 +800,14 @@ Request.JSONF = function(options){//oke
if (ini.option.length > 0) {
if (val[0].button.length > 0) {
$.each(val[0].button, function(keyb, valb){
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : valb[0];
var _link = (aTombol[valb[0]][1]==1) ? 'fon-tabel-dt' : valb[0];
var _cssa = (valb[1]=='') ? '' : ' text-'+valb[1];
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
if (ini.config.txtbutton === true) {
_tbtn1 += '<button class="btn tbl-rowbtn d-none d-lg-inline-block '+valb[0]+_cssb+' me-2" type="button">'+aTombol[valb[0]]+'</button>';
_tbtn2 += '<a class="table-icon d-lg-none '+valb[0]+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
_tbtn1 += '<button class="btn tbl-rowbtn d-none d-lg-inline-block '+_link+_cssb+' me-2" type="button">'+aTombol[valb[0]][0]+'</button>';
_tbtn2 += '<a class="table-icon d-lg-none '+_link+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]][0]+'"><i class="icon cui-'+valb[0]+'"></i></a>';
} else {
_tbtn2 += '<a class="table-icon '+valb[0]+_cssa+'" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
_tbtn2 += '<a class="table-icon '+_link+_cssa+'" title="'+aTombol[valb[0]][0]+'"><i class="icon cui-'+valb[0]+'"></i></a>';
}
})
}
@@ -858,14 +858,14 @@ Request.JSONF = function(options){//oke
if (ini.option.length > 0) {
if (optval.button.length > 0) {
$.each(optval.button, function(keyb, valb){
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : valb[0];
var _link = (aTombol[valb[0]][1]==1) ? 'fon-tabel-dt' : valb[0];
var _cssa = (valb[1]=='') ? '' : ' text-'+valb[1];
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
if (ini.config.txtbutton === true) {
_tbtn1 += '<button class="btn tbl-rowbtn d-none d-lg-inline-block '+valb[0]+_cssb+' me-2" type="button">'+aTombol[valb[0]]+'</button>';
_tbtn2 += '<a class="table-icon d-lg-none '+valb[0]+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
_tbtn1 += '<button class="btn tbl-rowbtn d-none d-lg-inline-block '+_link+_cssb+' me-2" type="button">'+aTombol[valb[0]][0]+'</button>';
_tbtn2 += '<a class="table-icon d-lg-none '+_link+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]][0]+'"><i class="icon cui-'+valb[0]+'"></i></a>';
} else {
_tbtn2 += '<a class="table-icon '+valb[0]+_cssa+'" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
_tbtn2 += '<a class="table-icon '+_link+_cssa+'" title="'+aTombol[valb[0]][0]+'"><i class="icon cui-'+valb[0]+'"></i></a>';
}
})
}
@@ -960,32 +960,33 @@ Request.JSONF = function(options){//oke
this.checked = this.value == val.avalue[0];
});
} else if (val.type == 'button'){
if (val.icon == 'fon-tabel-dt'){
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
var tr = $(this).closest('tr');
var row = otabel.row(tr);
if (row.child.isShown()){
row.child.hide();
tr.removeClass('shown');
}else{
var fnc = val.func.split('.');
if (typeof window[fnc[0]][fnc[1]] === 'function'){
var _dt_id = $('<div id="TD_Fonia_' + parseInt(Math.random() * 99999999) + '" />');
row.child(_dt_id).show();
tr.addClass('shown');
window[fnc[0]][fnc[1]](row.data(), _dt_id);
} else console.warn('fungsi '+val.func+' tidak ada !');
$('#'+ini.id+'Tabel tbody').on('click', '.'+val.icon, function(){
var dta = otabel.row($(this.closest('tr'))).data();
var fnc = val.func.split('.');
if (typeof window[fnc[0]][fnc[1]] === 'function') { window[fnc[0]][fnc[1]](dta, this); }
else if (typeof window[fnc[0]] === 'function') { window[fnc[0]](dta, this); }
else console.warn('fungsi '+val.func+' tidak ada !');
});
} else if (val.type == 'button-dt'){
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
var tr = $(this).closest('tr');
var row = otabel.row(tr);
if (row.child.isShown()){
row.child.hide();
tr.removeClass('shown');
}else{
if (otabel.row('.shown').length){
$('.fon-tabel-dt', otabel.row('.shown').node()).click();
}
});
} else {
$('#'+ini.id+'Tabel tbody').on('click', '.'+val.icon, function(){
var dta = otabel.row($(this.closest('tr'))).data();
var _dt_id = $('<div id="TD_Fonia_' + parseInt(Math.random() * 99999999) + '" class="fon-tabel-child" />');
row.child(_dt_id).show();
tr.addClass('shown');
var fnc = val.func.split('.');
if (typeof window[fnc[0]][fnc[1]] === 'function') { window[fnc[0]][fnc[1]](dta, this); }
else if (typeof window[fnc[0]] === 'function') { window[fnc[0]](dta, this); }
else console.warn('fungsi '+val.func+' tidak ada !');
});
}
if (typeof window[fnc[0]][fnc[1]] === 'function'){
window[fnc[0]][fnc[1]](row.data(), _dt_id);
} else console.warn('fungsi '+val.func+' tidak ada !');
}
});
}
});
}
+10 -6
View File
@@ -6,9 +6,9 @@
Desc. : v4 - HTML Table (jQuery & Bootstrap)
Created By : Siau Pheng (siaupheng@3fonia.com).
Created Date : January 16th, 2008.
Last Modified : October 19th, 2023.
Last Modified : December 4th, 2025.
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
(c) 2008 - 2025, 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
@@ -112,8 +112,12 @@ final class Table {
$this->__acontrol['value'] = $tvalue;
}
public function add_row_form($tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
$this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => "fon-tabel-dt", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue];
public function add_row_form($ticon = "pencil", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
if ($tfunc == "") {
$this->__aoption[] = ['type' => "button-dt", 'func' => $tlabel, 'icon' => "pencil", 'label' => $ticon];
} else {//todo: new format with icon, upgrade all later !
$this->__aoption[] = ['type' => "button-dt", 'func' => $tfunc, 'icon' => $ticon, 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue];
}
}
public function add_row_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "", $tfield_css = "", $avalue_css = []) {
@@ -184,7 +188,7 @@ final class Table {
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
// adding all option
for ($i=0; $i<count($this->__aoption); $i++) {
if ($this->__aoption[$i]['type']=="button") {
if (in_array($this->__aoption[$i]['type'], ["button","button-dt"])) {
if (($this->__aoption[$i]['field']!="") && ($this->__cdb->Row($this->__aoption[$i]['field'])<>(trim("".$this->__aoption[$i]['value'])!="" ? $this->__aoption[$i]['value'] : $_SESSION['__WEB_USER']['UNIX']))) {} else {
$aoption['button'][] = [$this->__aoption[$i]['icon'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??'')];
}
@@ -265,7 +269,7 @@ final class Table {
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
// adding all option
for ($i=0; $i<count($this->__aoption); $i++) {
if ($this->__aoption[$i]['type']=="button") {
if (in_array($this->__aoption[$i]['type'], ["button","button-dt"])) {
if (($this->__aoption[$i]['field']!="") && ($this->__cdb->Row($this->__aoption[$i]['field'])<>(trim("".$this->__aoption[$i]['value'])!="" ? $this->__aoption[$i]['value'] : $_SESSION['__WEB_USER']['UNIX']))) {} else {
$aoption['button'][] = [$this->__aoption[$i]['icon'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??'')];
}