datatable with livedata

This commit is contained in:
2023-10-16 17:19:15 +07:00
parent a6ce730088
commit 9bea66a705
2 changed files with 181 additions and 126 deletions
+59 -1
View File
@@ -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 : July 6th, 2023. Last Modified : October 16th, 2023.
(c) 2009 - 2023, 3FONIA Software; WWW.3FONIA.COM. (c) 2009 - 2023, 3FONIA Software; WWW.3FONIA.COM.
@@ -850,6 +850,61 @@ Request.JSONF = function(options){//oke
$(divData).append(strTab + strHead + strBody + strFoot + '</table>'); $(divData).append(strTab + strHead + strBody + strFoot + '</table>');
var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{return JSON.parse(localStorage.getItem(ini.id));}catch(e){}} }; var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{return JSON.parse(localStorage.getItem(ini.id));}catch(e){}} };
/*****/
if (ini.config.live){
var post_data = {};
$(vars.data).map(function(key, item){
var keyval = item.split("=");
return post_data[keyval[0]] = keyval[1];
});
opsi.serverSide = true;
opsi.ajax = {
url: vars.url,
type: 'POST',
data: post_data,
dataFilter: function(data){
var json = jQuery.parseJSON(data), jsono = {};
jsono.draw = json[0].draw;
jsono.recordsTotal = json[0].recordsTotal;
jsono.recordsFiltered = json[0].recordsFiltered;
jsono.data = json[0].data;
$.each(jsono.data, function(key, val){
//strBody += '<tr'+(val[0].rowcss?' class="'+val[0].rowcss+'"':'')+'>';
/*$.each(val, function(keyi, vali){
if (keyi == 0) return;
var _title = (ini.header[(keyi-1)].f.indexOf('awr') >= 0) ? ' title="' + vali.replace(/<br\s*[\/]?>/gi,'\n').replace(/(<([^>]+)>)/gi,'') + '"' : '';
});*/
// belum bisa css row/tr
// belum bisa title u/ awr class
var optval = val[0]; jsono.data[key].shift();
if (ini.option.length > 0) {
var _tbtn1 = "", _tbtn2 = "";
if (optval.button.length > 0) {
$.each(optval.button, function(keyb, valb){
var _icon = (valb[0]=='fon-tabel-dt') ? 'pencil' : 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>';
} else {
_tbtn2 += '<a class="table-icon '+valb[0]+_cssa+'" title="'+aTombol[valb[0]]+'"><i class="icon cui-'+_icon+'"></i></a>';
}
})
}
if (optval.checkbox) {
_tbtn1 += '<div><input class="form-check-input" type="checkbox" id="_cbox_'+optval.checkbox.field+'" value="'+optval.checkbox.value+'"></div>';
}
jsono.data[key].push(_tbtn1+_tbtn2);
}
});
return JSON.stringify(jsono);
}
};
}
/******/
if (ini.option.length > 0) opsi.columnDefs.push({responsivePriority:3,targets:-1}, {orderable:false,targets:-1}); if (ini.option.length > 0) opsi.columnDefs.push({responsivePriority:3,targets:-1}, {orderable:false,targets:-1});
if (ini.navi.func_navi == '') opsi.paging = false; if (ini.navi.func_navi == '') opsi.paging = false;
var _lmenu = []; var _lmenu = [];
@@ -886,6 +941,9 @@ Request.JSONF = function(options){//oke
if (ini.navi.button) $('#'+ini.id+'Tabel_wrapper div.toolbar').html(_navibar); if (ini.navi.button) $('#'+ini.id+'Tabel_wrapper div.toolbar').html(_navibar);
} }
opsi.drawCallback = function(settings){ opsi.drawCallback = function(settings){
/*var api = this.api();
console.log( api.rows( {page:'current'} ).data() );
console.log( settings );*/
} }
var otabel = $('#'+ini.id+'Tabel').DataTable(opsi); var otabel = $('#'+ini.id+'Tabel').DataTable(opsi);
+122 -125
View File
@@ -6,7 +6,7 @@
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 : May 18th, 2023. Last Modified : October 16th, 2023.
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM. (c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
@@ -17,30 +17,32 @@ declare(strict_types=1);
namespace siaupheng\fonia3\Web; namespace siaupheng\fonia3\Web;
final class Table { final class Table {
private $__table = "";
private $__tquery = ""; private $__tquery = "";
private $__tquery_footer = ""; private $__tquery_footer = "";
private $__aheader = array(); private $__aheader = [];
private $__afield = array(); private $__afield = [];
private $__astyle = array(); private $__astyle = [];
private $__aformat = array(); private $__aformat = [];
private $__afooter = array(); private $__afooter = [];
private $__aotype = array(); private $__aotype = [];
private $__arowcol = array(); private $__arowcol = [];
private $__arow_func = array(); private $__arow_func = [];
private $__tfunc_select = ""; private $__tfunc_select = "";
private $__tfunc_navi = ""; private $__tfunc_navi = "";
private $__btxtbutton = false; private $__btxtbutton = false;
private $__bnobutton = false; private $__bnobutton = false;
private $__bscrollbar = false; private $__bscrollbar = false;
private $__acontrol = array('field'=>false, 'value'=>""); private $__acontrol = ['field'=>false, 'value'=>""];
private $__acbox = array(); private $__acbox = [];
private $__aoption = array(); private $__aoption = [];
private $__npage_rec = 10; private $__npage_rec = 10;
private $__nreclimit = 0; private $__nreclimit = 0;
private $__nscrollheight = 0; private $__nscrollheight = 0;
private $__ord_field = ""; private $__ord_field = "";
private $__ord_dir = "A"; private $__ord_dir = "A";
private $__tcss = ""; private $__tcss = "";
private $__livedata = false;
protected $__cdb = null; protected $__cdb = null;
public function __construct($db = null){ public function __construct($db = null){
@@ -48,6 +50,10 @@ final class Table {
else { $this->__cdb = new \siaupheng\fonia3\DB\MySQL(); } else { $this->__cdb = new \siaupheng\fonia3\DB\MySQL(); }
} }
public function set_table($ttable = "") {
$this->__table = $ttable;
}
public function set_query($tquery = "") { public function set_query($tquery = "") {
$this->__tquery = $tquery; $this->__tquery = $tquery;
} }
@@ -80,7 +86,7 @@ final class Table {
public function set_row_color($tfield = "", $tval = "", $tcss = "") { public function set_row_color($tfield = "", $tval = "", $tcss = "") {
if ($tfield=="") return; if ($tfield=="") return;
$this->__arowcol[] = array('F'=>$tfield, 'V'=>$tval, 'C'=>$tcss); $this->__arowcol[] = ['F'=>$tfield, 'V'=>$tval, 'C'=>$tcss];
} }
public function set_func_navi($tfunc = "") { public function set_func_navi($tfunc = "") {
@@ -92,7 +98,7 @@ final class Table {
} }
public function set_func_btn($tfunc = "", $tlabel = "") { public function set_func_btn($tfunc = "", $tlabel = "") {
$this->__arow_func[] = array('label' => $tlabel, 'func' => $tfunc); $this->__arow_func[] = ['label' => $tlabel, 'func' => $tfunc];
} }
public function set_row_control($tfield = "", $tvalue = "Y") { public function set_row_control($tfield = "", $tvalue = "Y") {
@@ -101,26 +107,26 @@ final class Table {
} }
public function add_row_form($tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") { public function add_row_form($tlabel = "", $tfunc = "", $tfield = "", $tvalue = "") {
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => "fon-tabel-dt", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue); $this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => "fon-tabel-dt", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue];
} }
public function add_row_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "", $tfield_css = "", $avalue_css = array()) { public function add_row_btn($ticon = "", $tlabel = "", $tfunc = "", $tfield = "", $tvalue = "", $tfield_css = "", $avalue_css = []) {
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => $ticon, 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue, 'field_css' => $tfield_css, 'avalue_css' => $avalue_css); $this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => $ticon, 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue, 'field_css' => $tfield_css, 'avalue_css' => $avalue_css];
} }
public function add_row_del($tlabel = "", $tfunc = "", $tfield = "Unix", $tvalue = "") { public function add_row_del($tlabel = "", $tfunc = "", $tfield = "Unix", $tvalue = "") {
$this->__aoption[] = array('type' => "button", 'func' => $tfunc, 'icon' => "x", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue); $this->__aoption[] = ['type' => "button", 'func' => $tfunc, 'icon' => "x", 'label' => $tlabel, 'field' => $tfield, 'value' => $tvalue];
} }
public function add_row_edit($tlabel = "", $tfunc = "") { public function add_row_edit($tlabel = "", $tfunc = "") {
$this->add_row_btn("note", $tlabel, $tfunc); $this->add_row_btn("note", $tlabel, $tfunc);
} }
public function add_row_checkbox($tfield = "ID", $tcontrol = "Edit", $avalue = array("Y","N")) { public function add_row_checkbox($tfield = "ID", $tcontrol = "Edit", $avalue = ["Y","N"]) {
$this->__acbox['field'] = $tfield; $this->__acbox['field'] = $tfield;
$this->__acbox['control'] = $tcontrol; $this->__acbox['control'] = $tcontrol;
$this->__acbox['avalue'] = $avalue; $this->__acbox['avalue'] = $avalue;
$this->__aoption[] = array('type' => "checkbox", 'field' => $tfield, 'avalue' => $avalue); $this->__aoption[] = ['type' => "checkbox", 'field' => $tfield, 'avalue' => $avalue];
} }
public function no_button() { public function no_button() {
@@ -137,11 +143,11 @@ final class Table {
} }
public function json_table($nama_tabel = "tabel_", $baris_tabel = 10) { public function json_table($nama_tabel = "tabel_", $baris_tabel = 10) {
$adata = array(); $adata = []; $njml_kol = 0;
// adding header // adding header
for ($i=0; $i<count($this->__afield); $i++) { for ($i=0; $i<count($this->__afield); $i++) {
$adata['header'][] = array('f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i], 's'=>$this->__aotype[$i]); $adata['header'][] = ['f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i], 's'=>$this->__aotype[$i]];
$njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1; $njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1;
} }
@@ -158,144 +164,135 @@ final class Table {
} else { } else {
$tval2 = ($this->__afooter[$i]<>"") ? $this->__afooter[$i] : $tval; $tval2 = ($this->__afooter[$i]<>"") ? $this->__afooter[$i] : $tval;
} }
$adata['footer'][] = array('c'=>$tval2); $adata['footer'][] = ['c'=>$tval2];
} }
} }
$acontent = array(); $acontent = [];
$this->__cdb->Query($this->__tquery); if (!$this->__livedata) {
while ($this->__cdb->Next()) { $this->__cdb->Query($this->__tquery);
$abaris = array(); while ($this->__cdb->Next()) {
$aoption = array('button'=>array()); $abaris = [];
if (count($this->__aoption)>0) { $aoption = ['button'=>[]];
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) { if (count($this->__aoption)>0) {
// adding all option if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
for ($i=0; $i<count($this->__aoption); $i++) { // adding all option
if ($this->__aoption[$i]['type']=="button") { for ($i=0; $i<count($this->__aoption); $i++) {
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]['type']=="button") {
$aoption['button'][] = array($this->__aoption[$i]['icon'], (empty($this->__aoption[$i]['field_css'])?'':$this->__aoption[$i]['avalue_css'][$this->__cdb->Row($this->__aoption[$i]['field_css'])]??'')); 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'])]??'')];
}
} }
} }
} // adding checkbox option
// adding checkbox option if (array_key_exists("field", $this->__acbox)) {
if (array_key_exists("field", $this->__acbox)) { $aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']); $aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']); }
} }
} }
} if (count($this->__arowcol)>0) {//up: 2014-06-13
if (count($this->__arowcol)>0) {//up: 2014-06-13 for ($i=0; $i<count($this->__arowcol); $i++) {
for ($i=0; $i<count($this->__arowcol); $i++) { if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C']; }
} }
} $abaris[] = $aoption;
$abaris[] = $aoption; for ($i=0; $i<count($this->__afield); $i++) {
for ($i=0; $i<count($this->__afield); $i++) { $tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05 if (is_array($this->__aformat[$i])) {
if (is_array($this->__aformat[$i])) { $tval = $this->__aformat[$i][$tval];
$tval = $this->__aformat[$i][$tval]; } else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) {
} else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) { $tval = call_user_func($this->__aformat[$i], $tval);
$tval = call_user_func($this->__aformat[$i], $tval); }
$abaris[] = $tval;
} }
$abaris[] = $tval; $acontent[] = $abaris;
} }
$acontent[] = $abaris;
} }
// navigator // navigator
$anavi = array('func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func ); $anavi = [ 'func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func ];
$adata['type'] = "table"; $adata['type'] = "table";
$adata['id'] = $nama_tabel; $adata['id'] = $nama_tabel;
$adata['config'] = array('css' => $this->__tcss, 'row_count' => $baris_tabel, 'func_select' => $this->__tfunc_select, 'nobutton' => $this->__bnobutton, 'txtbutton' => $this->__btxtbutton, 'scrollbar' => $this->__bscrollbar, 'scroll_height' => $this->__nscrollheight, 'sort_col' => $this->__ord_field, 'sort_dir' => $this->__ord_dir); $adata['config'] = ['css' => $this->__tcss, 'row_count' => $baris_tabel, 'func_select' => $this->__tfunc_select, 'nobutton' => $this->__bnobutton, 'txtbutton' => $this->__btxtbutton, 'scrollbar' => $this->__bscrollbar, 'scroll_height' => $this->__nscrollheight, 'sort_col' => $this->__ord_field, 'sort_dir' => $this->__ord_dir, 'live' => $this->__livedata];
$adata['option'] = array(); $adata['option'] = [];
foreach ($this->__aoption as $aval) { foreach ($this->__aoption as $aval) {
if ($aval['type']!=="checkbox") unset($aval['field']); unset($aval['value']); unset($aval['field_css']); unset($aval['value_css']); $adata['option'][] = $aval; if ($aval['type']!=="checkbox") unset($aval['field']); unset($aval['value']); unset($aval['field_css']); unset($aval['value_css']); $adata['option'][] = $aval;
} }
$adata['navi'] = $anavi; $adata['navi'] = $anavi;
$adata['content'] = $acontent; $adata['content'] = $acontent;
return $adata; return $adata;
} }
/*public function json_table_db($nama_tabel = "tabel_", $baris_tabel = 10) {//new public function db_table($nama_tabel = "tabel_", $baris_tabel = 10) {
$adata = array(); $this->__livedata = true;
$dbpage = \siaupheng\fonia3\Web\Param::Get($nama_tabel.'_pg', 0); $id_draw = intval($_REQUEST['draw'] ?? 0);//
$i_start = intval($_REQUEST['start'] ?? 0);//
// adding header $i_length = intval($_REQUEST['length'] ?? 0);//
for ($i=0; $i<count($this->__afield); $i++) { $i_order = intval($_REQUEST['order'] ?? 0);//
$adata['header'][] = array('f'=>$this->__astyle[$i], 'o'=>$this->__afield[$i], 'c'=>$this->__aheader[$i]);//add width later
$njml_kol += ($this->__astyle[$i]=="hidden") ? 0 : 1;
}
// adding footer if ($id_draw > 0) {
if ($this->__tquery_footer) { $t_order = "ASC";
$this->__cdb->Query($this->__tquery_footer); if ($i_order <> 0) {
$this->__cdb->Next(); $t_order = ($i_order[0]['dir']=="asc") ? "ASC" : "DESC";
for ($i=0; $i<count($this->__afield); $i++) { $i_order = $i_order[0]['column'];
$tval = $this->__cdb->Row($this->__afield[$i], 0);
if (is_array($this->__afooter[$i])) {
$tval2 = $this->__afooter[$i][$tval];
} else if (function_exists($this->__afooter[$i])) {
$tval2 = call_user_func($this->__afooter[$i], $tval);
} else {
$tval2 = ($this->__afooter[$i]<>"") ? $this->__afooter[$i] : $tval;
}
$adata['footer'][] = array('c'=>$tval2);
} }
} $sql_limit = ($i_start>=0 && $i_length != -1) ? " LIMIT ".$i_start.", ".$i_length : "";
$sql_order = ($this->__afield[$i_order]) ? " ORDER BY ".$this->__afield[$i_order]." ".$t_order : "";
$acontent = array(); $record = 0;
$this->__cdb->Query($this->__tquery); $this->__cdb->Query("SELECT COUNT(*) Item FROM ".$this->__table);
while ($this->__cdb->Next()) { if ($this->__cdb->Next()) $record = intval($this->__cdb->Row("Item", 0));
$abaris = array(); $adata['draw'] = $id_draw;
$aoption = array('button'=>array()); $adata['recordsTotal'] = $record;
if (count($this->__aoption)>0) { $adata['recordsFiltered'] = $record;
if ((($this->__acontrol['field']===false) || ($this->__cdb->Row($this->__acontrol['field'])==$this->__acontrol['value'])) && $this->__bnobutton===false) {
// adding all option $adata['data'] = [];
for ($i=0; $i<count($this->__aoption); $i++) { $this->__cdb->Query("SELECT `".implode('`,`', $this->__afield)."` FROM ".$this->__table.$sql_order.$sql_limit);
if ($this->__aoption[$i]['type']=="button") { while ($this->__cdb->Next()) {
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 { $abaris = [];
$aoption['button'][] = $this->__aoption[$i]['icon']; $aoption = ['button'=>[]];
if (count($this->__aoption)>0) {
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 (($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'])]??'')];
}
} }
} }
} // adding checkbox option
// adding checkbox option if (array_key_exists("field", $this->__acbox)) {
if (array_key_exists("field", $this->__acbox)) { $aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']);
$aoption['checkbox']['field'] = $this->__cdb->Row($this->__acbox['field']); $aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']);
$aoption['checkbox']['value'] = $this->__cdb->Row($this->__acbox['control']); }
} }
} }
} if (count($this->__arowcol)>0) {//up: 2014-06-13
if (count($this->__arowcol)>0) {//up: 2014-06-13 for ($i=0; $i<count($this->__arowcol); $i++) {
for ($i=0; $i<count($this->__arowcol); $i++) { if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C'];
if ($this->__cdb->Row($this->__arowcol[$i]['F']) == $this->__arowcol[$i]['V']) $aoption['rowcss'] = $this->__arowcol[$i]['C']; }
} }
} $abaris[] = $aoption;
$abaris[] = $aoption; for ($i=0; $i<count($this->__afield); $i++) {
for ($i=0; $i<count($this->__afield); $i++) { $tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05
$tval = stripslashes($this->__cdb->Row($this->__afield[$i]));//up: 2015-01-05 if (is_array($this->__aformat[$i])) {
if (is_array($this->__aformat[$i])) { $tval = $this->__aformat[$i][$tval];
$tval = $this->__aformat[$i][$tval]; } else if (!is_null($this->__aformat[$i]) && function_exists($this->__aformat[$i])) {
} else if (function_exists($this->__aformat[$i])) { $tval = call_user_func($this->__aformat[$i], $tval);
$tval = call_user_func($this->__aformat[$i], $tval); }
$abaris[] = $tval;
} }
$abaris[] = $tval; $adata['data'][] = $abaris;
} }
$acontent[] = $abaris;
} else {
$adata = $this->json_table($nama_tabel, $baris_tabel);
} }
// navigator
$anavi = array('func_navi' => $this->__tfunc_navi, 'button' => $this->__arow_func );
$adata['type'] = "table";
$adata['id'] = $nama_tabel;
$adata['config'] = array('page'=>$dbpage, 'row_count' => $baris_tabel, 'func_select' => $this->__tfunc_select, 'nobutton' => $this->__bnobutton, 'txtbutton' => $this->__btxtbutton, 'scrollbar' => $this->__bscrollbar, 'scroll_height' => $this->__nscrollheight, 'sort_col' => $this->__ord_field, 'sort_dir' => $this->__ord_dir);
$adata['option'] = $this->__aoption;
$adata['navi'] = $anavi;
$adata['content'] = $acontent;
return $adata; return $adata;
}*/ }
} }
?> ?>