The columns and their headers are not aligned. It happens when I use column fields with a custom value map. I did not test if it happens also for column fields without the custom value map. Here is a working code shwing the problem. The code is using the sample database table "payments":
<html><body>
<?php
/* Bug:
*
* - Column Headers not aligned with their values
*/
$KoolControlsFolder = "../classes/KoolControls";
require_once($KoolControlsFolder."/KoolAjax/koolajax.php");
$koolajax->scriptFolder = $KoolControlsFolder."/KoolAjax";
require $KoolControlsFolder."/KoolPivotTable/koolpivottable.php";
class MyValueMap implements PivotIValueMap
{
function map($_value)
{
return array("YEAR" => substr($_value, 0, 4) );
}
function getMapFields()
{
return array("YEAR");
}
}
/// MAIN
$db = mysql_connect("localhost", "root", "root");
mysql_select_db("kooltest");
$ds = new MySQLPivotDataSource($db);
$ds->select("customerNumber, paymentDate, amount")->from("payments");
$pivot = new KoolPivotTable("pivot");
$pivot->scriptFolder = $KoolControlsFolder."/KoolPivotTable";
$pivot->styleFolder = "office2007";
$pivot->DataSource = $ds;
$pivot->AjaxEnabled = true;
$pivot->Width = "1400px";
$pivot->HorizontalScrolling = true;
$pivot->Height = "800px";
$pivot->HorizontalScrolling = true;
$pivot->AllowFiltering = true;
$pivot->AllowSorting = true;
$pivot->AllowSortingData = true;
$pivot->AllowReorder = true;
$pivot->AllowCaching = true;
$pivot->ShowGrandColumn = false;
$pivot->ShowStatus = true;
$pivot->Appearance->RowHeaderMinWidth = "200px";
//Use the Prev and Next Numneric Pager
$pivot->Pager = new PivotPrevNextAndNumericPager();
$pivot->Pager->PageSize = 20;
//DATA FIELD
$field = new PivotSumField("amount");
$field->Text = "AMOUNT";
$field->FormatString = "{n}";
$field->AllowReorder = false;
$field->AllowFiltering = false;
$pivot->AddDataField($field);
$pivot->SetDataFieldForSorting($field);
// COLUMN FIELD
$field = new PivotField("paymentDate");
$field->setValueMap(new MyValueMap());
$field->AllowReorder = false;
$pivot->AddColumnField($field);
// ROW FIELD
$field = new PivotField("customerNumber");
$field->Text = "CUSTOMER CODE";
$field->AllowReorder = false;
$pivot->AddRowField($field);
$pivot->Process();
?>
<form id="form1" method="post">
<?php echo $koolajax->Render();?>
<div style="padding-top:10px;">
<?php echo $pivot->Render();?>
</div>
</form>
</body></html>