ActiveReportsレポート

このサンプルは、Wijmo ReportViewerコントロールでGrapeCity ActiveReports WebサービスからGrapeCity ActiveReportsレポートを表示する方法を示します。

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as viewer from '@grapecity/wijmo.viewer'; import { getReports } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let reportViewer = new viewer.ReportViewer('#reportViewer', { serviceUrl: 'https://demo.grapecity.com/activereports/ar12reportservice/ActiveReports.ReportService.asmx' }); let lbReports = document.querySelector('#reports'); lbReports.addEventListener('change', () => loadReport()); // // fill reports list fillReportList(getReports()); loadReport(); // function fillReportList(reports) { let selCat = reports.selectedReport.categoryName, selRep = reports.selectedReport.reportName; // reports.categories.forEach(cat => { let optGroup = createComboOptionGroup(cat.name); // cat.reports.forEach(rep => { let option = createComboOption(rep.reportName, rep.filePath); // option.selected = cat.name === selCat && rep.reportName === selRep; optGroup.appendChild(option); }); // lbReports.appendChild(optGroup); }); } // function loadReport() { reportViewer.filePath = lbReports.value; } // function createComboOptionGroup(text) { let optGroup = document.createElement('optgroup'); optGroup.label = text; return optGroup; } // function createComboOption(text, value) { let option = document.createElement('option'); option.innerHTML = text; option.value = value; return option; } } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Viewing ActiveReports reports</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div class="row report-names"> <label for="reports">ActiveReportsレポートの選択:</label> <select id="reports" class="combobox"></select> </div> <div id="reportViewer"></div> </div> </body> </html> // export function getReports() { return { selectedReport: { categoryName: "日本語レポート", reportName: "見積書" }, categories: [ { name: "日本語レポート", reports: [ { filePath: "Estimate.rdlx", reportName: "見積書" }, { filePath: "Paymentslip_page.rdlx", reportName: "払込取扱票" }, { filePath: "ChainStoreUniformSlip.rdlx", reportName: "仕入伝票" } ] } ] }; } body { margin-bottom: 24px; } label { margin-right: 3px; } .wj-viewer { width: 100%; display: block; } .report-names { margin: 10px; } @media print { .report-names { display: none; } } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjViewerModule } from '@grapecity/wijmo.angular2.viewer'; import { getReports, TReportCategory } from './app.data'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { public categories: TReportCategory[]; public filePath: string; // constructor() { let reports = getReports(); // this.categories = reports.categories; // Get the selected report's filePath property. this.filePath = reports .categories.find(cat => cat.name === reports.selectedReport.categoryName) .reports.find(rep => rep.reportName === reports.selectedReport.reportName) .filePath; } } // @NgModule({ imports: [WjViewerModule, BrowserModule, FormsModule], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Viewing ActiveReports reports</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <div class="row report-names"> <label for="reports">ActiveReportsレポートの選択:</label> <select id="reports" class="combobox" [(ngModel)]="filePath"> <ng-template ngFor let-cat [ngForOf]="categories"> <optgroup *ngIf="cat.reports" label="{{cat.name}}"> <option *ngFor="let rep of cat.reports" [value]="rep.filePath"> {{rep.reportName}} </option> </optgroup> </ng-template> </select> </div> <wj-report-viewer [serviceUrl]="'https://demo.grapecity.com/activereports/ar12reportservice/ActiveReports.ReportService.asmx'" [filePath]="filePath"> </wj-report-viewer> </div> export type TReport = { filePath: string; reportName: string; }; // export type TReportCategory = { name: string; reports: TReport[]; }; // export type TReports = { selectedReport: { categoryName: string; reportName: string; }; categories: TReportCategory[]; }; // export function getReports() { return <TReports>{ selectedReport: { categoryName: "日本語レポート", reportName: "見積書" }, categories: [ { name: "日本語レポート", reports: [ { filePath: "Estimate.rdlx", reportName: "見積書" }, { filePath: "Paymentslip_page.rdlx", reportName: "払込取扱票" }, { filePath: "ChainStoreUniformSlip.rdlx", reportName: "仕入伝票" } ] } ] }; } body { margin-bottom: 24px; } label { margin-right: 3px; } .wj-viewer { width: 100%; display: block; } .report-names { margin: 10px; } @media print { .report-names { display: none; } } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as wjViewer from '@grapecity/wijmo.react.viewer'; import { getReports } from './data'; class App extends React.Component { constructor(props) { super(props); let reports = getReports(); let filePath = reports.categories.filter(cat => cat.name === reports.selectedReport.categoryName)[0] .reports.filter(rep => rep.reportName === reports.selectedReport.reportName)[0] .filePath; this._categories = reports.categories; this.state = { filePath: filePath }; } render() { return <div className="container-fluid"> <div className="row report-names"> <label> ActiveReportsレポートの選択: <select id="reports" className="combobox" value={this.state.filePath} onChange={this._filePathChanged.bind(this)}> {this._categories.map(cat => { return <optgroup key={cat.name} label={cat.name}> {cat.reports.map(rep => { return <option key={rep.filePath} value={rep.filePath}> {rep.reportName} </option>; })} </optgroup>; })} </select> </label> </div> <wjViewer.ReportViewer filePath={this.state.filePath} serviceUrl="https://demo.grapecity.com/activereports/ar12reportservice/ActiveReports.ReportService.asmx"> </wjViewer.ReportViewer> </div>; } _filePathChanged(e) { this.setState({ filePath: e.target.value }); } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexGrid Column DataMaps</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> body { margin-bottom: 24px; } label { margin-right: 3px; } .wj-viewer { width: 100%; display: block; } .combobox { margin-left: 5px; height: 25px; font-weight: normal; } .report-names { margin: 10px; } @media print { .report-names { display: none; } } // export function getReports() { return { selectedReport: { categoryName: "日本語レポート", reportName: "見積書" }, categories: [ { name: "日本語レポート", reports: [ { filePath: "Estimate.rdlx", reportName: "見積書" }, { filePath: "Paymentslip_page.rdlx", reportName: "払込取扱票" }, { filePath: "ChainStoreUniformSlip.rdlx", reportName: "仕入伝票" } ] } ] }; } <template> <div class="container-fluid"> <div class="row report-names"> <label for="reports">ActiveReportsレポートの選択:</label> <select id="reports" class="combobox" v-model="filePath"> <optgroup v-for="cat in categories" :key="cat.name" :label="cat.name"> <option v-for="rep in cat.reports" :key="rep.filePath" :value="rep.filePath"> {{rep.reportName}} </option> </optgroup> </select> </div> <wj-report-viewer serviceUrl="https://demo.grapecity.com/activereports/ar12reportservice/ActiveReports.ReportService.asmx" :filePath="filePath"> </wj-report-viewer> </div> </template> <script> import 'bootstrap.css'; import "@grapecity/wijmo.styles/wijmo.css"; import Vue from 'vue'; import '@grapecity/wijmo.vue2.viewer'; import { getReports } from './data'; // new Vue({ el: '#app', data: { filePath: '', categories: null }, created() { let reports = getReports(); // this.categories = reports.categories; // Get the selected report's filePath property this.filePath = reports .categories.filter(cat => cat.name === reports.selectedReport.categoryName)[0] .reports.filter(rep => rep.reportName === reports.selectedReport.reportName)[0] .filePath; } }); </script> <style> body { margin-bottom: 24px; } label { margin-right: 3px; } .container-fluid .wj-viewer { width: 100%; display: block; } .report-names { margin: 10px; } @media print { .report-names { display: none; } } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Viewing ActiveReports reports</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> export function getReports() { return { selectedReport: { categoryName: "日本語レポート", reportName: "見積書" }, categories: [ { name: "日本語レポート", reports: [ { filePath: "Estimate.rdlx", reportName: "見積書" }, { filePath: "Paymentslip_page.rdlx", reportName: "払込取扱票" }, { filePath: "ChainStoreUniformSlip.rdlx", reportName: "仕入伝票" } ] } ] }; }