☝️Small business or a startup? See if you qualify for our special offer.
+

Install react-flexmonster correctly css file not listed in node_modules package file

Answered
Carlos Lenon asked on May 29, 2025

Hi Flexmonster Team,
I'm Lenon, Frontend Engineer for FreeBalance company.

As company we testing some pivot table solutions because we interested to adquire a license of one of these solutions. In this moment we testing the flexmonster solution.

I'm trying to build a vite/react POC project in order to test the flexmonster features, but i facing some issues:

1. I having issue with the react component installation using the cli tool.

2. The css file style not listed in the node_module react-flexmonster files

3. Having issue with the connection datasource

 

I shared some screenshot in order to share more details.

I'll appreciate your support and assitance in this process, so we can reach to test all the diff features the flexmonster give us using the react component

 

I'll be waiting on your contact

Regard

13 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster May 30, 2025

Hello, Lenon!

Thank you for reaching out to us.

Please find detailed comments on all your questions below:

1) I having issue with the react component installation using the cli tool.

As an entry point, we'd like to share with you all the ways you can get Flexmonster with React:

If the CLI approach doesn't work well for you, we kindly ask for more details about the issue, e.g., if there was an error message in the console, so we can investigate the case further.

2) The css file style not listed in the node_module react-flexmonster files

Please note that the command npm install react-flexmonster adds two folders to your project:

  • flexmonster folder with all minified scripts and styles responsible for the component to work properly
  • react-flexmonster folder with the React wrapper for Flexmonster(e.g. with this wrapper you can apply React hooks to Flexmonster)

So, the CSS styles should be located at node_modules\flexmonster\flexmonster.min.css.

You can check out the full project's structure by the link: https://www.flexmonster.com/faq/#download-package.

3) Having issue with the connection datasource

To begin with, please check if your case is covered in our data sources guide: https://www.flexmonster.com/doc/supported-data-sources/.

If you have any additional questions about connecting to the data source, provide us with more details about the case, so we can reproduce it on our side.
Any screenshots and code snippets would be a great help.

Please let us know if you have any further questions.

Kind regards,
Solomiia

Public
Carlos Lenon May 30, 2025

Hi Solomia,

Thanks for getting back to me.

Let me do a new installation in a poco new project. Following your step.

 

Public
Carlos Lenon May 30, 2025

Hi Solomia,

I laready download the github pivot-react repo.

I laready ran it on my local and install the /typescript project dependencies.

Everything is running fine on my local with the example.

This example is using .json connection type. So, I want to use my own connection.

What I did is declare the event onReady and set the connection object but its does not works. I do not see anything loading and no error is showing. I may missing some value in the configuration.

 

Here is some screenshot and info about the diff ways i trying to fix my issue. SOrryabout the comments code, but I just want you te see where I missing.

import { useEffectuseRefuseState } from 'react';
import Stack from '@mui/material/Stack';
import Box from '@mui/material/Box';
import LinearProgress from '@mui/material/LinearProgress';
import CircularProgress from '@mui/material/CircularProgress';
import Button from '@mui/material/Button';
import * as FlexmonsterReact from 'react-flexmonster';

function Pivote() {
  const pivotRefReact.RefObject<FlexmonsterReact.Pivot | null> =
    useRef<FlexmonsterReact.Pivot>(null);
  const [isPivotConfigLoadingsetIsPivotConfigLoading] = useState(false);
  const [pivotDataSourceInfosetPivotDataSourceInfo] = useState<string>('');
  const [pivotDataSourceTypesetPivotDataSourceType] = useState<string>('');
  const [pivotDataSourceCatalogsetPivotDataSourceCatalog] =
    useState<string>('');
  const [pivotDataSourceCubesetPivotDataSourceCube] = useState<string>('');

  const fetchDataSourceInfo = async () => {
    if (pivotRef && pivotRef.current) {
      setIsPivotConfigLoading(true);
      const flexmonsterIntance = pivotRef.current.flexmonster;
      const dataSourcesInfostring[] =
        await flexmonsterIntance.getXMLADataSourcesAsync(proxyURL);
      const dataSourceTypestring =
        await flexmonsterIntance.getXMLAProviderNameAsync(proxyURL);
      const catalogsstring[] = await flexmonsterIntance.getXMLACatalogsAsync(
        proxyURL,
        dataSourcesInfo[0]
      );
      const cubesstring[] = await flexmonsterIntance.getXMLACubesAsync(
        proxyURL,
        dataSourcesInfo[0],
        catalogs[0]
      );

      if (
        dataSourcesInfo.length > 0 &&
        dataSourceType &&
        catalogs.length > 0 &&
        cubes.length > 0
      ) {
        const pivotCNX = {
          type: 'microsoft analysis services',
          proxyURL: '[our olap xmla url.../xmla]',
          dataSourceInfo: dataSourcesInfo[0],
          catalog: catalogs[0],
          cube: cubes[3],
        };
        flexmonsterIntance.connectTo(pivotCNX);
        // setPivotDataSourceInfo(dataSourcesInfo[0]);
        // setPivotDataSourceType(dataSourceType);
        // setPivotDataSourceCatalog(catalogs[0]);
        // setPivotDataSourceCube(cubes[3]);
        // console.log('dataSourceInfo', dataSourcesInfo);
        // console.log('dataSourceType', dataSourceType);
        // console.log('catalog', catalogs);
        // console.log('cube', cubes);
        setIsPivotConfigLoading(false);
      }
    }
  };

  // useEffect(() => {
  //   fetchDataSourceInfo();
  // }, []);
  const connectPivotHandler = () => {
    fetchDataSourceInfo();
  };

  const pivotReadyHandler = () => {
    if (pivotRef && pivotRef.current) {
      setIsPivotConfigLoading(true);
      const flexmonsterIntance = pivotRef.current.flexmonster;
      const pivotCNX = {
        type: 'microsoft analysis services',
        proxyURL: '[our olap xmla url.../xmla]',
        dataSourceInfo: 'Transparency Portal',
        catalog: 'OLAP_KOSOVO_DWH',
        cube: 'COA2022_004',
      };
      flexmonsterIntance.connectTo(pivotCNX);
      // setPivotDataSourceInfo(dataSourcesInfo[0]);
      // setPivotDataSourceType(dataSourceType);
      // setPivotDataSourceCatalog(catalogs[0]);
      // setPivotDataSourceCube(cubes[3]);
      // console.log('dataSourceInfo', dataSourcesInfo);
      // console.log('dataSourceType', dataSourceType);
      // console.log('catalog', catalogs);
      // console.log('cube', cubes);
      setIsPivotConfigLoading(false);
    }
  };

  return (
    <div id="pivot-table">
      {isPivotConfigLoading && (
        <>
          <Box
            sx={{
              display: 'flex',
              justifyContent: 'center',
              marginBottom: '10px',
            }}
          >
            <CircularProgress />
          </Box>
          <Stack
            sx={{
              width: '100%',
              color: 'grey.500',
            }}
            spacing={2}
          >
            <LinearProgress color="secondary" />
          </Stack>
        </>
      )}
      <Button variant="text" onClick={connectPivotHandler}>
        CONNECT
      </Button>
      {/* <FlexmonsterReact.Pivot
        ref={pivotRef}
        toolbar={true}
        ready={pivotReadyHandler}
      /> */}
      <FlexmonsterReact.Pivot
        ref={pivotRef}
        toolbar={true}
        report={{
          dataSource: {
            type: 'json',
            data: [
              { Category: 'Beverages'Sales: 100 },
              { Category: 'Snacks'Sales: 150 },
            ],
          },
        }}
      />
    </div>
  );
}

NOTE
If you connect using the connect dialog from table its works properly. But if you set the connect via the connectTo method or via the dataSourceObject, setting those at the beginning is does not works.

For XMLA datasource type, the documentation require to use this approach config

pivot.connectTo({
  type: 'microsoft analysis services',
  proxyUrl: 'https://olap.flexmonster.com/olap/msmdpump.dll',
  dataSourceInfo: 'Provider=MSOLAP; Data Source=extranet;',
  catalog: 'Adventure Works DW Standard Edition',
  cube: 'Adventure Works'
});

In our case, folling the documentation should be

 const pivotCNX = {
          type: 'microsoft analysis services',
          proxyURL: '[our olap xmla url.../xmla]',
          dataSourceInfo: dataSourcesInfo[0],
          catalog: catalogs[0],
          cube: cubes[3],
       };

 
But this does not work.
 
By the otherhand, if I try to connect using the connect modal called from the pivot table toolbar using my custom url its work fine
 


 
I'll appreciate your help,
If we can have a video call in order to solve this. It'll be perfect. Because I need to build this POC for flexmonster, if not I'll have to search for other tools.
Regards
 

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 2, 2025

Hello, Lenon!

Thank you for the provided details. And we are happy to hear that our sample project was helpful!

If we understand the case correctly, Flexmonster connects to your XMLA endpoint from the UI and the data is shown, but there's something missing while connecting to the OLAP XMLA data source from the code.

As a first step, let's try to connect Flexmonster to OLAP data source in the report object. Here is the code snippet for reference:

import React from "react";
import * as FlexmonsterReact from "react-flexmonster";

class PivotTableDemo extends React.Component {
render() {
return (
<>
<div className="App">
<FlexmonsterReact.Pivot
report={{
dataSource: {
type: "microsoft analysis services",
proxyURL: '[your olap xmla url.../xmla]',
catalog: catalogs[0],
cube: cubes[3],
},
}}
/>
</div>
</>
);
}
}

export default PivotTableDemo;

Please check that your custom variables(catalogs, cubes, etc) are returning the correct values when initializing Flexmonster. We recommend trying to use the string values in dataSource object to locate the cause of the described behavior.

Our Sales Representative will also send you the follow-up email with more organizational information.

Please let us know if the suggested approach was helpful to connect Flexmonster to OLAP cube via XMLA.
Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 11, 2025

Hello, Lenon!

Hope you are doing well.

Our team is wondering if you had some time to try the suggested approach and connect Flexmonster to your OLAP cube via XMLA. Could you please let us know if you have any further questions about integrating Flexmonster?

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Carlos Lenon June 11, 2025

Hi Solomiia,
Thanks for heading back.

I was going to send answer to you.

 

Yes, I reach to connect to the OLAP cube VIA XMLA.

In this moment I need to know how access to the JSON created when you click the Save button from the toolbar. The idea is to save this JSON file and then let the users switch between reports.

I already check that the react component expose subscription of the events. But what I need is to acces to report json generated when the Save button is clicked

Can you please share an example of it, using react component?

Or a link where I can read the API doc about it.

I appreciate your help
Regards

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 12, 2025

Hello, Lenon!

Thank you for your swift response.

We are happy to hear that the OLAP cube is now connected and everything works well.

Regarding your question about saving the report, could you please explain the desired flow in more detail? Do you want to predefine some reports for the users? Or should the user be able to add new reports to the list at runtime? Also, do you want to customize our "Save" tab or add a new UI control outside Flexmonster?
With more understanding of the desired behavior, we'll be able to advise you better.

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Carlos Lenon June 12, 2025

Hi Solomiia,
Thanks for your answer.

What we need essentially, is to know if you have any available options to access the report .json file generated from clicking the Toolbar "Save" button.

I do not now if this can happen from customizing the toolbar Save tab button or from any available events subscription you have exposed in the react component ref lib. In fact, in the list of available subscribed event you have exposed from the react component ref, we do not see any event that we can use to access to this .json report file.

Please let me know which should be the best approache to handle this necessity we have.

I'll be waiting on your support
Regards

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 13, 2025

Hello, Lenon!

Thank you for your quick response.

Our team recommends using getReport() API call to retrieve the report programmatically as a JSON object: https://jsfiddle.net/flexmonster/8hrmnc9L/.
Then, it is possible to change the current report with setReport() API call. You may also need to wait for reportcomplete event before retrieving the report, e.g., when trying to get the report on initial load.

Certain parts of the report can also be updated separately, e.g., the slice can be changed using runQuery(). Here is the full list of all available API calls: https://www.flexmonster.com/api/.

You are welcome to check the example of working with our API calls in React in our sample project: https://github.com/flexmonster/pivot-react/blob/master/typescript/src/components/ReactFlexmonsterExamples/UsingAPICalls.tsx.

Hope you will find our answer helpful.

Kind regards,
Solomiia

Public
Carlos Lenon June 13, 2025

Hi Solomiia,
Thanks for your support.

Currently, I using those methods get..() and set..() in our POC. But this get..() method is usefull when you want to access to the report .json() in any async moment.

But this is not what wee need, and let me explain it to you.
We need to access the report .json file in order to save it in our logic. But, wee need to access to this json when the Toolbar Save button is clicked and the json is ready to save, in this moment is where wee need to access to this report .json file. And if its possible, redefine the Toolbar Save button behavior, so insted of opening a file save dialog we can fetch a API call to save this .json() file.

Can you please double check with the dev team, to see which options are available for this.

I'll be waiting on your contact,
Regards

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 16, 2025

Hello!

Thank you for providing more details about your use case.

Kindly note that it is possible to change the Toolbar Save tab behavior and extract the report JSON object via getReport() instead of saving the report file to the local system. Then, you can apply any custom API to the extracted JSON object and save it where you need.

We have prepared a JSFiddle to illustrate the idea: https://jsfiddle.net/flexmonster/zhygm8ej/.

Could you please let us know if the suggested approach would work for your case?

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Carlos Lenon June 16, 2025

Hi Solomiia,
I hope you had good weekend.

Thanks for your answer. An yes, this is what we needs. How is possible I missed that part of the doc.

Let me test and ceck all what you're sharing and I'll comeback to you.

Thanks for your time,
Regards

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster June 16, 2025

Hello, Lenon!

Thank you for your feedback.

We are happy to hear that the suggested approach of customizing the Save tab works well for you.

Feel free to reach out to us in case of any other questions.

Kind regards,
Solomiia

Please login or Register to Submit Answer