Код: Выделить всё
import React, {useEffect} from "react";
import stimPkg from "stimulsoft-dashboards-js/Scripts/stimulsoft.designer";
const {Stimulsoft} = stimPkg;
export default function DesignerPage() {
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
const templateName = urlParams.get("template");
const designerOptions = new Stimulsoft.Designer.StiDesignerOptions();
designerOptions.appearance.fullScreenMode = true;
designerOptions.height = "100%";
const designer = new Stimulsoft.Designer.StiDesigner(designerOptions, "StiDesigner", false);
const report = new Stimulsoft.Report.StiReport();
const recommendationModelDetails = {
code: "123",
surveyId: "someSurveyId",
version: 42,
metrics: [
{
metricId: "m1",
code: "CODE1",
name: "Metric #1",
},
{
metricId: "m2",
code: "CODE2",
name: "Metric #2",
}
],
surveyRecommendations: [
{
surveyRecommendationId: "sr1",
code: "REC01",
name: "First recommendation",
text: "Some text",
attachments: [3, 4, 5],
roles: [1, 2, 3],
},
]
};
if (templateName) {
report.loadFile(`/bff/api/reports/template?name=${templateName}`);
}
report.regData("First",
"First_alias",
recommendationModelDetails)
const dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readJson(JSON.stringify(recommendationModelDetails));
report.regData("Second",
"Second_alias",
dataSet)
report.regBusinessObject([
new Stimulsoft.Report.Dictionary.StiBusinessObjectData(
"CtpCategory",
"ModelContainer",
"RecommendationModel",
recommendationModelDetails
),
new Stimulsoft.Report.Dictionary.StiBusinessObjectData("Test", "Test", "Test2", [
{
myValue: 1
}
])
]);
report.dictionary.synchronizeBusinessObjects();
report.dictionary.synchronize();
designer.report = report;
designer.renderHtml("designerContainer");
console.log('businessObjects', report.dictionary.businessObjects)
}, []);
return (
<main className="w-full h-screen">
<h1 className="p-4 text-xl font-bold">Редактор отчёта</h1>
<div id="designerContainer" style={{width: "100%", height: "90%"}}/>
</main>
);
}
Проблема в том, что regData работает и я его вижу, а regBusinessObject кажется нет
В левой части я не вижу свои бизнес объекты
Но вижу их названия в data column, но не могу их использовать, т.к они не распахиваются. Что делать?