table child update
This commit is contained in:
+4
-16
@@ -4,9 +4,9 @@
|
|||||||
Desc. : CSS Default Configuration
|
Desc. : CSS Default Configuration
|
||||||
Created By : Siau Pheng ([email protected]).
|
Created By : Siau Pheng ([email protected]).
|
||||||
Created Date : December 20th, 2007.
|
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 {
|
table.dataTable.table-bordered tr:last-child td {
|
||||||
border-bottom-width: 1px !important;
|
border-bottom-width: 1px !important;
|
||||||
}
|
}
|
||||||
table.dataTable a.fon-tabel-dt i {
|
table.dataTable.table-hover tbody tr:has(td > div.fon-tabel-child):hover {
|
||||||
padding-top: 2px;
|
background-color: transparent;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
div.dataTables_wrapper div.toolbar button {
|
div.dataTables_wrapper div.toolbar button {
|
||||||
font-size: unset;
|
font-size: unset;
|
||||||
|
|||||||
+35
-34
@@ -4,7 +4,7 @@
|
|||||||
Desc. : JS - Fonia Custom Class v3
|
Desc. : JS - Fonia Custom Class v3
|
||||||
Created By : Siau Pheng ([email protected]).
|
Created By : Siau Pheng ([email protected]).
|
||||||
Created Date : June 19th, 2009.
|
Created Date : June 19th, 2009.
|
||||||
Last Modified : December 3rd, 2025.
|
Last Modified : December 4th, 2025.
|
||||||
|
|
||||||
(c) 2009 - 2025, 3FONIA Software; WWW.3FONIA.COM.
|
(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]+'">';
|
strAksi = '<input class="form-check-input" type="checkbox" id="'+ini.id+'_cbhead_'+val.field+'" value="'+val.avalue[1]+'">';
|
||||||
ChkField = val.field;
|
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>';
|
strHead += '<th data-class-name="c">'+strAksi+'</th>';
|
||||||
aSortCol.push(null);
|
aSortCol.push(null);
|
||||||
@@ -800,14 +800,14 @@ Request.JSONF = function(options){//oke
|
|||||||
if (ini.option.length > 0) {
|
if (ini.option.length > 0) {
|
||||||
if (val[0].button.length > 0) {
|
if (val[0].button.length > 0) {
|
||||||
$.each(val[0].button, function(keyb, valb){
|
$.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 _cssa = (valb[1]=='') ? '' : ' text-'+valb[1];
|
||||||
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
|
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
|
||||||
if (ini.config.txtbutton === true) {
|
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>';
|
_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 '+valb[0]+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
|
_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 {
|
} 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 (ini.option.length > 0) {
|
||||||
if (optval.button.length > 0) {
|
if (optval.button.length > 0) {
|
||||||
$.each(optval.button, function(keyb, valb){
|
$.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 _cssa = (valb[1]=='') ? '' : ' text-'+valb[1];
|
||||||
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
|
var _cssb = (valb[1]=='') ? ' normal' : ' btn-'+valb[1];
|
||||||
if (ini.config.txtbutton === true) {
|
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>';
|
_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 '+valb[0]+_cssa+'" tabindex="-1" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
|
_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 {
|
} 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];
|
this.checked = this.value == val.avalue[0];
|
||||||
});
|
});
|
||||||
} else if (val.type == 'button'){
|
} else if (val.type == 'button'){
|
||||||
if (val.icon == 'fon-tabel-dt'){
|
$('#'+ini.id+'Tabel tbody').on('click', '.'+val.icon, function(){
|
||||||
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
|
var dta = otabel.row($(this.closest('tr'))).data();
|
||||||
var tr = $(this).closest('tr');
|
var fnc = val.func.split('.');
|
||||||
var row = otabel.row(tr);
|
if (typeof window[fnc[0]][fnc[1]] === 'function') { window[fnc[0]][fnc[1]](dta, this); }
|
||||||
if (row.child.isShown()){
|
else if (typeof window[fnc[0]] === 'function') { window[fnc[0]](dta, this); }
|
||||||
row.child.hide();
|
else console.warn('fungsi '+val.func+' tidak ada !');
|
||||||
tr.removeClass('shown');
|
});
|
||||||
}else{
|
} else if (val.type == 'button-dt'){
|
||||||
var fnc = val.func.split('.');
|
$('#'+ini.id+'Tabel tbody').on('click', '.fon-tabel-dt', function(){
|
||||||
if (typeof window[fnc[0]][fnc[1]] === 'function'){
|
var tr = $(this).closest('tr');
|
||||||
var _dt_id = $('<div id="TD_Fonia_' + parseInt(Math.random() * 99999999) + '" />');
|
var row = otabel.row(tr);
|
||||||
row.child(_dt_id).show();
|
if (row.child.isShown()){
|
||||||
tr.addClass('shown');
|
row.child.hide();
|
||||||
window[fnc[0]][fnc[1]](row.data(), _dt_id);
|
tr.removeClass('shown');
|
||||||
} else console.warn('fungsi '+val.func+' tidak ada !');
|
}else{
|
||||||
|
if (otabel.row('.shown').length){
|
||||||
|
$('.fon-tabel-dt', otabel.row('.shown').node()).click();
|
||||||
}
|
}
|
||||||
});
|
var _dt_id = $('<div id="TD_Fonia_' + parseInt(Math.random() * 99999999) + '" class="fon-tabel-child" />');
|
||||||
} else {
|
row.child(_dt_id).show();
|
||||||
$('#'+ini.id+'Tabel tbody').on('click', '.'+val.icon, function(){
|
tr.addClass('shown');
|
||||||
var dta = otabel.row($(this.closest('tr'))).data();
|
|
||||||
var fnc = val.func.split('.');
|
var fnc = val.func.split('.');
|
||||||
if (typeof window[fnc[0]][fnc[1]] === 'function') { window[fnc[0]][fnc[1]](dta, this); }
|
if (typeof window[fnc[0]][fnc[1]] === 'function'){
|
||||||
else if (typeof window[fnc[0]] === 'function') { window[fnc[0]](dta, this); }
|
window[fnc[0]][fnc[1]](row.data(), _dt_id);
|
||||||
else console.warn('fungsi '+val.func+' tidak ada !');
|
} else console.warn('fungsi '+val.func+' tidak ada !');
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-6
@@ -6,9 +6,9 @@
|
|||||||
Desc. : v4 - HTML Table (jQuery & Bootstrap)
|
Desc. : v4 - HTML Table (jQuery & Bootstrap)
|
||||||
Created By : Siau Pheng ([email protected]).
|
Created By : Siau Pheng ([email protected]).
|
||||||
Created Date : January 16th, 2008.
|
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;
|
$this->__acontrol['value'] = $tvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_row_form($tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
|
public function add_row_form($ticon = "pencil", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
|
||||||
$this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => "fon-tabel-dt", 'label' => $tlabel, 'field' => $tfield, 'value' => $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 = []) {
|
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) {
|
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||||
// adding all option
|
// adding all option
|
||||||
for ($i=0; $i<count($this->__aoption); $i++) {
|
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 {
|
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'])]??'')];
|
$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) {
|
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
|
||||||
// adding all option
|
// adding all option
|
||||||
for ($i=0; $i<count($this->__aoption); $i++) {
|
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 {
|
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'])]??'')];
|
$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'])]??'')];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user