rally - Print capability in App SDK 2 -


i add print capability app sdk 2 custom app displays grid , print option under gear icon, print page empty. have example of app prints grid?

a grid app example found here modified include printing capability:

<!doctype html> <html> <head>     <title>gridexample</title>      <script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>      <script type="text/javascript">         rally.onready(function () {             ext.define('customapp', {                 extend: 'rally.app.app',                 componentcls: 'app',                  launch: function() {                     rally.data.modelfactory.getmodel({                         type: 'userstory',                         success: function(model) {                             this.grid = this.add({                                 xtype: 'rallygrid',                                 itemid: 'grid',                                 model: model,                                 columncfgs: [                                     'formattedid',                                     'name',                                     'owner'                                 ],                                 storeconfig: {                                     filters: [                                         {                                             property: 'schedulestate',                                             operator: '=',                                             value: 'defined'                                         }                                     ]                                 }                             });                         },                         scope:                     });                 },                 getoptions: function() {                     return [                         {                             text: 'print',                             handler: this._onbuttonpressed,                             scope:                         }                     ];                 },                  _onbuttonpressed: function() {                     options = "toolbar=1,menubar=1,scrollbars=yes,scrolling=yes,resizable=yes,width=1000,height=500";                      var css = document.getelementsbytagname('style')[0].innerhtml;                     var title = "user stories";                     var printwindow = window.open('', '', options);                      var doc = printwindow.document;                      var grid = this.down('#grid');                      doc.write('<html><head>' + '<style>' + css + '</style><title>' + title + '</title>');                     doc.write('</head><body class="landscape">');                     doc.write('<p>my grid: ' + title + '</p><br />');                     doc.write(grid.getel().dom.innerhtml);                     doc.write('</body></html>');                     doc.close();                      this._injectcss(printwindow);                      printwindow.print();                  },                 _injectcss: function(printwindow){                     //find stylesheets on current page , inject them new page                     ext.each(ext.query('link'), function(stylesheet){                         this._injectcontent('', 'link', {                             rel: 'stylesheet',                             href: stylesheet.href,                             type: 'text/css'                         }, printwindow.document.getelementsbytagname('head')[0], printwindow);                     }, this);                 },                 _injectcontent: function(html, elementtype, attributes, container, printwindow){                     elementtype = elementtype || 'div';                     container = container || printwindow.document.getelementsbytagname('body')[0];                      var element = printwindow.document.createelement(elementtype);                      ext.object.each(attributes, function(key, value){                         if (key === 'class') {                             element.classname = value;                         } else {                             element.setattribute(key, value);                         }                     });                      if(html){                         element.innerhtml = html;                     }                      return container.appendchild(element);                 }             });              rally.launchapp('customapp', {                 name:"gridexample"                 //parentrepos:""             });          });     </script>      <style type="text/css">         .app {             /* add app styles here */         }     </style>  </head> <body></body> </html> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -