using php query to load datasource

I have set up the pivot in a php page (pivotreport.php)as suggested in the documentation as follows:
<div id=”pivotContainer”>The component will appear within this DIV.</div>
 <script type=”text/javascript” src=”flexmonster/flexmonster.js”></script>
 <script type=”text/javascript”>
   var params = {filename : “pivotreportdata.php”};
   flexmonster.embedPivotComponent(“flexmonster/”, “pivotContainer”,”100%”, “500”, params,true);
I am using a php query to select the data then send a csv file to the browser
$result = $db_con->query     ……etc
Then using a while statement to add the headers then the data to the csv file:
$csv_output .= implode(‘,’, $row);       $csv_output .= “\r\n”;
then output to the browser
header(‘Content-type: text/plain’);
print $csv_output;
I can row the pivotreportdata.php separately and the data outputs properly.
However when I run the pivotreport.php page, the pivot shows but no data is loaded.
Any help would be appreciated

2 answers

Roman Petrusha Staff March 6, 2016

Hi Pauls,
Could you please check with DevTools(F12) if you have any error message? Or send me your pivotreportdata.php sample to test with?


Roman Petrusha Staff March 7, 2016

Hi Pauls,
Thank you for the code samples.
Please try to specify the “dataSourceType” in params:

 var params = {
   dataSourceType: "csv",
   filename : "../pivotreportdata.php"
 flexmonster.embedPivotComponent("flexmonster/", "pivotContainer","100%", "650", params, true);

Hope this helps.

Please login or Register to Submit Answer