Informática Asociada ia doc & examples Index Examples List

ia\Lib\iaTableIt

Simple echo array to table

Documentation jit ia\Lib\iaTableIt Documentation Usage sample Function examples Index Examples List

class ia\Lib\iaTableIt


Index Documentation Usage sample Function examples Index Examples List

ia\Lib\iaTableIt


Usage sample ia\Lib\iaTableIt Documentation Usage sample Function examples Index Examples List

ia\Lib\iaTableIt
Simple echo array to table
Setup
De preferencia en header, poner el css <style> .tableitdiv{overflow-x:auto;border:4px blue double;} .tableit, .tableit TH, .tableit TD {border: 1px solid silver} .tableit {border-collapse:collapse;border-spacing:0;margin:auto;overflow-x:hidden;empty-cells:show} .tableit CAPTION {font-weight:bold;font-size:larger;} .tableit TH {padding:4px;background-color: whitesmoke} .tableit TD {padding:4px;vertical-align:top} .tableit TR:hover {background-color: #f5f5f5} .tableit TR:nth-child(even) {background-color: #f2f2f2} .tableit .lft {text-align:left} .tableit .cen {text-align:center} .tableit .rgt {text-align:right} .tableit .date {text-align:center;white-space:pre-line} .tableit .red {color:red} .tableit .green{color:darkgreen} .tableit .blue{color:blue} .tableit .remark{background-color:yellow} </style>
Usage
/** * Simple echo Array to table, keys are column headers * * @param array $arr data for table [ ['key1'=>1,'key2'=>'name'], ...] * @param string $caption * @param array $header [ 'key'=>['label'=>'', 'class'=>'', 'dec'=>4, 'prefix'=>'$', 'suffix'=>'MN', 'valueClass'=>['Si'=>'red', 'SI'=>'red'] ], ] * @param boolean $niceHeaders true label($key), false use keys. default true * @param string $idPrefix sets id for html tags: table id='tableit$idPrefix', tr id='tr$idPrefix$id' default tblIt * @param string $tableClass sets contining div to class='$tableClassdiv' and table's class='$tableClass'. Default tableit * @return void */
Simple
$data = [ ['item_id'=>12,'item_name'=>'Gato','value_int'=>12,'value_dec'=>12.1345,'ultimo_cambio'=>'2016-01-30','es_camion'=>'No'], ['item_id'=>18,'item_name'=>'Perro azul','value_int'=>-12,'value_dec'=>-12.1345,'ultimo_cambio'=>'2016-01-31','es_camion'=>'Si'], ]; iaTableIt::tableIt($data,"Los datos");
Los datos
Item IdItem NameValue IntValue DecÚltimo CambioEs Camión
12Gato1212.122016-01-30No
18Perro azul-12-12.122016-01-31Si
Specify headers
$header = [ 'es_camion'=>['class'=>'cen', 'valueClass'=>['Si'=>'red']], 'value_dec'=>[ 'label'=>'El Valor','dec'=>3 ], ]; iaTableIt::tableIt($data,"Los datos", $header);
Los datos
Item IdItem NameValue IntEl ValorÚltimo CambioEs Camión
12Gato12$12.123 MN2016-01-30No
18Perro azul-12$-12.123 MN2016-01-31Si

Examples by function ia\Lib\iaTableIt Documentation Usage sample Function examples Index Examples List

ia\Lib\iaTableIt
Simple echo array to table

Disclaimer: Auto generated file. Please help us setting parameters to useful values and extending the examples.

  • iaTableIt::tableIt_css() : void
    /**
        * Put css for tablit inside style tags
        *
        * @return void
        */
    
    1. iaTableIt::tableIt_css();" .tableitdiv{overflow-x:auto;border:4px blue double;} .tableit, .tableit TH, .tableit TD {border: 1px solid silver} .tableit {border-collapse:collapse;border-spacing:0;margin:auto;overflow-x:hidden;empty-cells:show} .tableit CAPTION {font-weight:bold;font-size:larger;} .tableit TH {padding:4px;background-color: whitesmoke} .tableit TD {padding:4px;vertical-align:top} .tableit TR:hover {background-color: #f5f5f5} .tableit TR:nth-child(even) {background-color: #f2f2f2} .tableit .lft {text-align:left} .tableit .cen {text-align:center} .tableit .rgt {text-align:right} .tableit .date {text-align:center;white-space:pre-line} .tableit .red {color:red} .tableit .green{color:darkgreen} .tableit .blue{color:blue} .tableit .remark{background-color:yellow}
  • iaTableIt::tableIt(array $arr, string $caption = '', array $header = [], boolean $niceHeaders = true, string $idPrefix = 'tblIt', string $tableClass = 'tableit') : void
    /**
         * Simple echo Array to table, keys are column headers
         *
         * @param array $arr Data for table [ ['key1'=>1,'key2'=>'name'], ...]
         * @param string $caption
         * @param array $header [ 'key'=>['label'=>'', 'class'=>'', 'dec'=>4, 'prefix'=>'$', 'suffix'=>'MN', 'valueClass'=>['Si'=>'red', 'SI'=>'red'] ], ]
         * @param boolean $niceHeaders true label($key), false use keys. default true
         * @param string $idPrefix sets id for html tags: table id='tableit$idPrefix', tr id='tr$idPrefix$id' default tblIt
         * @param string $tableClass sets contining div to class='$tableClassdiv' and table's class='$tableClass'. Default tableit
         * @return void
         */
    
    1. iaTableIt::tableIt([['a' => 'a', 'b' => '2', 'c' => 3],['a' => '11', 'b' => '12', 'c' => 13]]);"
      ABC
      b23
      111213

End: ia\Lib\iaTableIt Documentation Usage sample Function examples Index Examples List