Hi support team,
My problem is in order to avoid using hard code to define which columns' name and labels to be displayed in view, i am thinking is it possible to use dynamical way to loop out all desired columns and label name from queryB. My queryA from is Select * from tableA
and queryB is Select col_name, field_name from tableB where...
. QueryB will select all those desired columns and field name. What i have done so far was only display one column in view. Let say my queryB returns 5 records and i want to loop 5 times to display that 5 columns and field name, how could i done it? Thanks.
<?php
$col_name = $this->dataStore("queryB")->data()[0]["col_name"];
$field_name = $this->dataStore("queryB")->data()[0]["field_name "];
Table::create(array(
"dataStore"=>$this->dataStore('queryA'),
"columns"=>array(
$col_name=>array(
"label"=>$field_name
),
),
"cssClass"=>array(
"table"=>"table table-bordered"
)
));
?>