How to load the data.

Answered
David Chen asked on February 1, 2016

Trying to evaluate flexmonster pivot table.
 
The config file is where you specified where your data is located as well as pre determine rows/columns/aggregated function of which values
I was wondering if you can parse the code out instead looking at a physical file. for example
<div id="pivotContainer">The component will appear within this DIV.</div>
<script type="text/javascript" src="flexmonster/flexmonster.js"></script>
<script type="text/javascript">
flexmonster.embedPivotComponent("flexmonster/", "pivotContainer","100%", "500", {configUrl : "
<config>

<dataSource type="OCSV">

<browseForFile>false</browseForFile>

<filename>

 
<xml>
     ...... where you state your xml 
</xml>
 
 

</filename>

</dataSource>

<defaultSlice>

<axes>

<axis name="rows">

<hierarchy sort="asc">

<dimensionName>[Country]</dimensionName>
<hierarchyName>[Country].[Country]</hierarchyName>

</hierarchy>

<hierarchy>

"})
<script>
 
 
 
 

12 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster February 1, 2016

Hi David,
 
You can pass report object (which is an analogue of the config XML file) into embedPivotComponent() function as the 5th parameter. Please check the following live sample https://jsfiddle.net/irynakulchytska/tua7owjs/
 
More information about report object can be found in the documentation: http://www.flexmonster.com/api/. Please check getReport() and setReport() API calls.
 
Kind regards,
Iryna

Public
David Chen February 1, 2016

Exactly what we need!!
 
Another question I'm looking at All In One Demo
there is the menu: Connect, Open, Save, Grid, Charts, Format, Options, Fields, Export, Fullscreen.
Is it possible to hide Connect, Open, Save, Full Screen?
Also is it possible to hide the grid lines and well as the 1,2,3,4,5 grud header

Public
David Chen February 1, 2016

Trying to implement this code, does seems to be working.
 
SyntaxEditor Code Snippet

<div id='pivotContainer'></div> 
<script type='text/javascript' src='http://www.ourhost.....com/demo/html5/flexmonster/flexmonster.js'></script>
<script type='text/javascript'>
var jsondata = [{
    'Color': 'green',
    'M': 'September',
    'W': 'Wed',
    'country': 'Canada',
    'state': 'Ontario',
    'city': 'Toronto',
    'Price': 174,
    'Quantity': 22
  }, {
    'Color': 'red',
    'M': 'March',
    'W': 'Mon',
    'Time': '1000',
    'country': 'USA',
    'state': 'California',
    'city': 'Los Angeles',
    'Price': null,
    'Quantity': 19
  }];

var report = {
  configuratorActive: false,
  data: jsondata,
  rows: [{uniqueName: 'Color'}],
  columns: [{uniqueName: '[Measures]'}],
  measures: [{uniqueName: 'Price'}, {uniqueName: 'Quantity'}],
  formats: [{name: '', nullValue: 'blank'}]
};

flexmonster.embedPivotComponent('http://ourhost.../demo/html5/flexmonster/', 'pivotContainer','100%', '500', report, true);
</script>
Public
Iryna Kulchytska Iryna Kulchytska Flexmonster February 1, 2016

David,
 
I'm glad to read that this is exactly what you need.
 
Regarding your question about a possibility to hide Connect, Open, Save, Full Screen from the toolbar, it is possible to customize the toolbar as much as you need. Please find more information about hiding the buttons from the toolbar in the documentation - http://www.flexmonster.com/doc/customizing-toolbar/
 
Regarding your question about hiding the grid lines and well as the 1,2,3,4,5:
 - the grid lines can be removed by overriding CSS properties for grid cells - https://jsfiddle.net/irynakulchytska/tua7owjs/3/, as follows:
#fm-grid-view .fm-cell {
    border: 0px !important;
}
 - the rows/columns numbers can be hidden by setting the report property showHeaders to false, as follows: https://jsfiddle.net/irynakulchytska/tua7owjs/2/
 
 
Kind regards,
Iryna

Public
David Chen February 1, 2016

Thanks for answering the styling
The second issue was I'm trying implement the demo with your jsondata, it doesn't seem to be working 

Public
David Chen February 1, 2016

actually its working

Public
David Chen February 1, 2016

Another question, once I purchased it, the trial and the trademark at the bottom of the grid will be removed?

Public
daniil February 1, 2016

Hi David,
Thank you for your question. Yes, I do confirm that once you purchase the license, the trial watermark and the trademark will disappear at the bottom of the grid.
Kind regards,
Daniil

Public
David Chen February 1, 2016

Thank you, so far, I am very impress with it, we will definitely get it soon. Just need to evaluate playing it further especially with calculated field to see if it can achieve what we wanted. 

Public
David Chen February 3, 2016

Base on the below code: both Price Quantity will be “Sum”, I assume this is by default. How to I change the default say into Count or Average?
 
SyntaxEditor Code Snippet

  rows: [{uniqueName: 'Color'}],
  columns: [{uniqueName: '[Measures]'}],
  measures: [{uniqueName: 'Price'}, {uniqueName: 'Quantity'}],
Public
David Chen February 3, 2016

actually i will answer my question: 
 
SyntaxEditor Code Snippet

measures: [{uniqueName: 'Price', aggregation:'Count'}, { uniqueName:...
Public
Tanya Gryshko Tanya Gryshko Flexmonster December 7, 2016

Hello David and all Flexmonster users,
Please note that embedPivotComponent() method was deprecated in version 2.3. You should use $("#pivotContainer").flexmonster() instead. This method has report property to set a report. It can be inline Report Object, URL to report JSON or URL to report XML. After the release of version 2.3, the structure of Report Object was changed. For more details please refer to the documentation: http://www.flexmonster.com/doc/migration-guide/#structure.
Check the updated sample with hidden gridlines and headers: https://jsfiddle.net/flexmonster/f7ohzzrh/
Regards,
Tanya

Please login or Register to Submit Answer