ActiveReportsJSの機能を実装方法とともに説明します。
ビューワにレポートを描画する際、パラメータ入力を表示せずにコード上からパラメータを設定する場合、実装方法は次の通りです。
var parameters = [
{ Name: 'ReportParameter1', Value: ['Value1'] },
{ Name: 'ReportParameter2', Value: ['Value2'] }
];
viewer.open('report.rdlx-json', { ReportParams: parameters });
レポートの次のページに移動する場合、実装方法は次の通りです。
viewer.goToNextPage();
レポートの特定のページに移動する場合、実装方法は次の通りです。
viewer.goToPage(2);
レポートのプレビューを連続ページで表示されるよう変更します。レポートの初期表示時に連続ページで表示する場合、実装方法は次の通りです。
viewer = new ActiveReports.Viewer('#ARJSviewerDiv');
viewer.viewMode = 'Continuous'; // 「SinglePage」または「Continuous」を設定します。
viewer.open("report.rdlx-json");
レポートのプレビューをゲラモードに変更します。レポートの初期表示時にゲラモードで描画する場合、実装方法は次の通りです。
viewer = new ActiveReports.Viewer('#ARJSviewerDiv');
viewer.renderMode = 'Galley'; // 「Paginated」または「Galley」を設定します
viewer.open("report.rdlx-json");
ビューワの現在表示しているレポートを破棄し、プレビューをクリアします。実装方法は次の通りです。
viewer.resetDocument();
レポート定義ファイルを更新することなく、レポートにバインドされているデータソースの接続文字列を実行時に変更する場合、実装方法は次の通りです。
function UpdateDS() {
var report = new MESCIUS.ActiveReportsJS.Core.PageReport();
report.load('reports/ManufacturingInstruction_page.rdlx-json').then(
function(){
report._instance.definition.DataSources[0].ConnectionProperties.ConnectString = "jsondoc=Products.json";
return report.load(report._instance.definition);
}
).then(
function(){
report.run();
arjs_viewer.open(report);
}
);
}