Could you specify more information? Or at least indicate where to find a similar example?
How to connect to OData service from within StiDataTableSource?
i'm getting an error with the following code snippet:
Code: Select all
function init() {
var options = new window.Stimulsoft.Designer.StiDesignerOptions();
options.appearance.fullScreenMode = true;
var designer = new window.Stimulsoft.Designer.StiDesigner(options, 'StiDesigner', false);
var report = new window.Stimulsoft.Report.StiReport();
report.dictionary.databases.clear();
var connStr = "http://localhost:8882/stimulsoft_proxy_action/";
var database = new Stimulsoft.Report.Dictionary.StiODataDatabase("MyDataSource", "OData", connStr);
report.dictionary.databases.add(database);
var dataSource = new Stimulsoft.Report.Dictionary.StiDataTableSource("reservationsInfoView", "reservationsInfoView", "reservationsInfoView");
dataSource.columns.add(new Stimulsoft.Report.Dictionary.StiDataColumn("_id", "_id", "_id"));
dataSource.columns.add(new Stimulsoft.Report.Dictionary.StiDataColumn("reservationNumber", "reservationNumber", "reservationNumber"));
report.dictionary.dataSources.add(dataSource);
report.dictionary.synchronize();
report.render();
console.log(report);
designer.report = report;
designer.renderHtml('designerContent');
designer.onSaveReport = function (event) {
console.log('dataBases', report.dictionary.databases);
console.log(event);
};
}
invoking report.dictionary.synchronize(); throws an error (browsers console):
Code: Select all
TypeError: s.viewData is null stimulsoft.reports.js:143:224561
a</s.prototype.getDataFromDataSource http://localhost:8882/scripts/stimulsoft.reports.js:143:224561
a</s.prototype.connectDataSourceToData http://localhost:8882/scripts/stimulsoft.reports.js:143:225241
B</T.prototype.connect http://localhost:8882/scripts/stimulsoft.reports.js:143:210901
p</r.prototype.connect http://localhost:8882/scripts/stimulsoft.reports.js:143:288183
d</d.prototype.connect http://localhost:8882/scripts/stimulsoft.reports.js:144:210672
d</d.prototype.synchronize http://localhost:8882/scripts/stimulsoft.reports.js:144:203988
init http://localhost:8882/report/test:58:13
onload
Also when i remove line report.dictionary.synchronize(); from code i can see added datasources. But when dragged fields into table and try to preview them I'm getting the same error as above: "s.viewData is null"