Page 1 of 1

How to use oracle Data Adapter with react

Posted: Fri Sep 30, 2022 9:31 am
by mtecnic
Hello,
I have a webservice with asp net core where I created the data adapter like in the example showed in this link https://github.com/stimulsoft/Samples-J ... 0Databases.
This works if I create a page inside the asp net core project with the following code:

Code: Select all

@page
@model Example.Pages.IndexModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="shortcut icon" href="favicon.ico" />
    <title>Stimulsoft Reports.JS - ASP.NET Demo</title>

    <!-- Stimusloft Reports.JS -->
    <script src="Scripts/stimulsoft.reports.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.viewer.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.designer.js" type="text/javascript"></script>
    <script src="Scripts/stimulsoft.blockly.editor.js" type="text/javascript"></script>
</head>
<body onload="onLoad()">
    <script type="text/javascript">
        function onLoad() {
            StiOptions.WebServer.encryptData = false;
            StiOptions.WebServer.url = "/DataAdapters";
            var options = new Stimulsoft.Designer.StiDesignerOptions();
            options.appearance.fullScreenMode = true;
            var designer = new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false);
            designer.renderHtml("content");
            designer.report = new Stimulsoft.Report.StiReport();
        }
    </script>
    <div id="content"></div>
</body>
</html>
The problem is that I have an external app with electron + react and I want to connect the data adapter there, I've tried the following code:

Code: Select all

import React, { useEffect } from "react";
import useStateRef from "../../utils/Hooks/use-state-ref/useStateRef";

import { StiOptions } from "stimulsoft-reports-js/Scripts/stimulsoft.designer";
interface IPropsReportViewer {
  report: string;
}

interface IPropsReportDesigner {
  report?: string;
}

export function ReportDesigner(props: IPropsReportDesigner) {
  let Stimulsoft: any;
  const win: any = window;

  const [designer, setDesigner, designerRef] = useStateRef(null);

  useEffect(() => {
    Stimulsoft = win.Stimulsoft;

    StiOptions.WebServer.encryptData = false;
    StiOptions.WebServer.url = "https://192.168.0.1:44366/DataAdapters";

    var report = Stimulsoft.Report.StiReport.createNewReport();

    var options = new Stimulsoft.Designer.StiDesignerOptions();
    options.appearance.fullScreenMode = true;
    setDesigner(
      new Stimulsoft.Designer.StiDesigner(options, "StiDesigner", false)
    );

    designerRef.current.report = report;


    designerRef.current.renderHtml("designerContent");
  }, []);


  return <div id="designerContent"></div>;
}

With this code I get the following error when trying to connect:

https://imgur.com/a/lrvSNzY

How can I add a data adapter with react js?

Re: How to use oracle Data Adapter with react

Posted: Fri Sep 30, 2022 11:48 am
by Max Shamanov
Hello,

Do you get the same error when use the Stimulsoft Adapter ?

Thank you.

Re: How to use oracle Data Adapter with react

Posted: Fri Sep 30, 2022 2:30 pm
by mtecnic
You mean when using the one in this link https://github.com/stimulsoft/Samples-J ... 0Databases ?
Then yes, I get the same error.

Re: How to use oracle Data Adapter with react

Posted: Fri Sep 30, 2022 7:29 pm
by Lech Kulikowski
Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.

Re: How to use oracle Data Adapter with react

Posted: Mon Oct 03, 2022 2:21 pm
by mtecnic
I attach an electron + react app with the error. The server I used is from your github page https://github.com/stimulsoft/Samples-J ... 0Databases

Re: How to use oracle Data Adapter with react

Posted: Tue Oct 04, 2022 12:24 pm
by Max Shamanov
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: How to use oracle Data Adapter with react

Posted: Wed Oct 05, 2022 11:09 am
by Max Shamanov
Hello,

We have made some changes in your project, please check the attachments.
Also, we could not reproduce the problem with the client-side connection to oracle.

Thank you.