Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
ok i check the code in Table.tpl.php and i see the problem , why use rowspan , in this way you cant drive the multipage problem.
The area i modified is the span code. I use this and work like a charm.
if($span && isset($span[$i][$cKey]))
{
if($span[$i][$cKey]>0)
{
?>
<td row-value="<?php echo ($cKey!=="#")?$row[$cKey]:($i+$meta["columns"][$cKey]["start"]);?>" <?php echo ($tdStyle)?"style='$tdStyle'":""; ?> <?php if($tdClass){echo "class='".((gettype($tdClass)=="string")?$tdClass:$tdClass($row,$cKey))."'";} ?> >
<?php echo $this->formatValue(($cKey!=="#")?$row[$cKey]:($i+$meta["columns"][$cKey]["start"]),$meta["columns"][$cKey],$row);?>
</td>
<?php
} else { ?>
<td row-value="<?php echo ($cKey!=="#")?$row[$cKey]:($i+$meta["columns"][$cKey]["start"]);?>" <?php echo ($tdStyle)?"style='$tdStyle'":""; ?> <?php if($tdClass){echo " class='".((gettype($tdClass)=="string")?$tdClass:$tdClass($row,$cKey))."'";} ?>>
<?php echo "";?>
</td>
<?php }
}
else
{
?>
<td row-value="<?php echo ($cKey!=="#")?$row[$cKey]:($i+$meta["columns"][$cKey]["start"]);?>" <?php echo ($tdStyle)?"style='$tdStyle'":""; ?> <?php if($tdClass){echo " class='".((gettype($tdClass)=="string")?$tdClass:$tdClass($row,$cKey))."'";} ?>>
<?php echo $this->formatValue(($cKey!=="#")?$row[$cKey]:($i+$meta["columns"][$cKey]["start"]),$meta["columns"][$cKey],$row);?>
</td>
<?php
}
here no rowspan and a blank cell when the condition if($span[$i][$cKey]>0) but is a span key. In this way 2 problems are solved , no misalignment between pages and always appears all the columns but empty when is necessary.
Let me know f the solution is ok.
You are right, there is problem there. I have told dev.team to fix this. One thing I have to agree that we should not use the rowspan and remove the consecutive td.
Your solution is great. There is only one issue that we would like to overcome that is when we move to next page, the value of group ( which is started from previous page but have not ended yet due to paging) does not show. So I am thinking of using javascript together with your solution.
Thank you very much for letting us know and promise to give a complete solution in next release (will be next month).
One suggestion, your code create a big array for the groups , my tests have 20,000 records and for rendering groups create an aiuxiliar array of 20,000 records !!!!
Thiis is a concept that shows that is not necessary the array , in template its better to do the group while rendering.
<?php
$data = array(
0 => array("Toyota","Corolla",2010,10),
1 => array("Toyota","Corolla",2011,15),
2 => array("Toyota","Audax",2011,20),
3 => array("Toyota","Auris",2012,30),
4 => array("Toyota","Auris",2013,10),
5 => array("Nissan","Agensa",2019,11),
6 => array("Nissan","March",2019,11),
7 => array("Bmw","550I",2018,11),
);
$fields = array(
"MARCA","MODELO","AÑO","CONTADOR"
);
$groups = array(
"MARCA","MODELO"
);
$idx = 0;
$currentLevelsData = array();
foreach ($data as $record) {
for ($i=0 ; $i < count($fields); $i++) {
// El nombre del campo esta en los grupos?
if (in_array($fields[$i],$groups)) {
if (!isset($currentLevelsData[$fields[$i]]) || $currentLevelsData[$fields[$i]] != $record[$i]) {
echo $record[$i];
$currentLevelsData[$fields[$i]] = $record[$i];
} else {
echo "*\t";
}
} else {
echo $record[$i].",";
}
}
echo "\n";
$idx++;
}
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo