找回密码
 立即注册

QQ登录

只需一步,快速开始

Lenka.Guo 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2016-8-9 11:00  /   查看:3257  /  回复:0
功能介绍:
ExtJS是一个Javascript库,功能强大,界面美观,可以使用Ajax, DHTML,DOM等技术开发网络应用程序。相信大家对Ext的基本功能已经了解,本贴主要讲述了如何将ActiveReports与Ext框架集成。使得开发项目即具有ext的优点,又具有ActiveReports强大的报表功能。

源码下载:




开发环境:

Visual Studio 2012 +ActiveReports 10  SP1+Web程序(如果不是此版本,可通过VS 中的工具-》转换为ActiveReports10 一键转化)



实现步骤:
1. 新建Web项目
2. 新添加HTML页面
3. 引入所有需要的脚本和资源文件



4. 新建RDL报表文件
右键添加新建项,添加报表:




5. 打开Index.html 页面,添加脚本引用:
  1. <script src="AR_Res/Scripts/jquery-1.10.2.js"></script>
  2.     <script src="AR_Res/Scripts/bootstrap-3.0.0.js"></script>
  3.     <script src="AR_Res/Scripts/knockout-2.3.0.js"></script>
  4.     <script src="AR_Res/Scripts/GrapeCity.ActiveReports.Viewer.Html.js"></script>
  5.    
复制代码


6. 使用Ext初始化页面
  1. Ext.create('Ext.panel.Panel', {
  2.                 title: 'Hello ActiveReports',
  3.                 width: '80%',
  4.                 height: 800,
  5.                 border: true,
  6.                 html: '<div id="viewerContainer"></div>',
  7.                 dockedItems: [
  8.                 {
  9.                     xtype: 'toolbar',
  10.                     name: 'gridToolBar',
  11.                     dock: 'top',
  12.                     border: false,
  13.                     items: [ {
  14.                         text: 'BillingInvoice.rdlx', handler: function (button) {
  15.                             LoadReport(button);
  16.                         }
  17.                     }, {
  18.                         text: 'Invoice.rpx', handler: function (button) {
  19.                             LoadReport(button);
  20.                         }
  21.                     }, {
  22.                         text: 'MoviesReport.rdlx', handler: function (button) {
  23.                             LoadReport(button);
  24.                         }
  25.                     }, {
  26.                         text: 'OilProducingCountries.rdlx', handler: function (button) {
  27.                             LoadReport(button);
  28.                         }
  29.                     }
  30.                     ]
  31.                 }
  32.                 ],
复制代码


7. 初始化HtmlViewer
  1.    Ext.onReady(function () {

  2.             function LoadReport(button) {

  3.                 var id="Reports/"+ button.text;

  4.                 var viewer = GrapeCity.ActiveReports.Viewer({
  5.                     report: {
  6.                         id:id
  7.                     },
  8.                     element: '#viewerContainer',
  9.                     reportService: {
  10.                         url: 'Reports/ActiveReports.ReportService.asmx'
  11.                     },
  12.                     uiType: 'desktop',
  13.                     localeUri: 'AR_Res/Scripts/i18n/Localeuri.txt'
  14.                 });
  15.             };
复制代码






本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部