Filter Print Templates in Web App Builder

2828
4
07-31-2015 09:26 AM
MichaelVolz
Esteemed Contributor

To All Web App Builder Users:

I created a web app with my own print service.  The print service contains 20 different print templates, 16 of which are for a custom application where access to the print templates is programmatically controlled.  When using the Web App Builder web app, all 20 print templates get displayed in a dropdown list.  Is there anyway to filter out print templates with the configurable Web App Builder?

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

  There is no configuration for this but it would be pretty simple to do this filtering in the code.

Just go into the Print.js file in the Print widgets folder and replace line 219 with something like this:

Old:

this.layoutDijit.addOption(layoutItems);

New:

      var new_layoutItems = array.filter(layoutItems, function(layout) {
        //this is where you are filtering out what you don't want added
        //or you do the opposite and only allow the ones you want to be returned
        return layout.label !== "Letter ANSI A Portrait";
      });
      this.layoutDijit.addOption(new_layoutItems);
0 Kudos
MichaelVolz
Esteemed Contributor

Robert:

I am not creating this web app in the developer version.  Can I still modify this code if the web app is hosted in AGOL and not Portal?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michael,

   No.

0 Kudos
MichaelVolz
Esteemed Contributor

Robert:

I added this as an Idea (on the ArcGIS Ideas website) as not everyone who can create a custom print service (no programming required), would be able to use the developer version of the Web App Builder where you showed me where to modify the code.  So if this was configurable in the Web App Builder, this problem would be solved without any need for a programmer.