Hi,
We are getting empty datagrid with no values.
1. I try both using $ds->select and its give empty page, and when I used $ds->SelectCommand it shows grid but no data.
2. Already tested that the db connection is all good.
Here is the code.
Would appreciate if you can help.
<?php
$KoolControlsFolder = "pivot/KoolControls";
require_once($KoolControlsFolder."/KoolAjax/koolajax.php");
$koolajax->scriptFolder = $KoolControlsFolder."/KoolAjax";
require $KoolControlsFolder."/KoolPivotTable/koolpivottable.php";
/// MAIN
$dbcon = mysql_connect("localhost", "root", "root");
mysql_select_db("kooltest");
$ds = new MySQLPivotDataSource($dbcon);
//$ds->select("name, city, total_deposits")->from("banks");
$ds->SelectCommand = "select name,city,state,total_deposits from banks limit 10";
$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("total_deposits");
$field->FormatString = "{n}";
$field->AllowFiltering = false;
$pivot->AddDataField($field);
// COLUMN FIELD
$field = new PivotField("name");
$pivot->AddColumnField($field);
// ROW FIELD
$field = new PivotField("city");
$pivot->AddRowField($field);
$pivot->Process();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>KoolPivotTable</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
</head>
<body>
<form id="form1" method="post">
<?php echo $koolajax->Render();?>
<div style="padding-top:10px;">
<?php echo $pivot->Render();?>
</div>
</form>
</body></html>