Select to view content in your preferred language

PrintWidget Layout dropdown list - How to get rid of some items

5488
20
Jump to solution
07-23-2012 12:06 PM
ShaningYu
Honored Contributor
In V3, I want to get rid of some items in the PrintWidget layout dropdown list.  However, all of these items are defined in the server-side Geoprocessing Print Tool.  Is there a way to filter out some of the items?  Thanks.
Tags (2)
0 Kudos
20 Replies
RobertScheitlin__GISP
MVP Emeritus
Derek and Caroline,

   The only way to get this to work properly is to fix it in the code. If you are able to make code changes than here are the necessary changes:

In the ExportWebMapForm.mxml find the initLayoutTemplates function and replace it with this one:

            private function initLayoutTemplates(serviceInfo:PrintServiceInfo):void
            {
                var layoutTemplatesVisibility:Boolean = true;
                layoutTemplatesFI.label = configXML.labels.layouttemplateslabel[0] || hostBaseWidget.getDefaultString("printLayoutTemplatesLabel");
                var layoutTemplates:IList = serviceInfo.layoutTemplates;
                
                //Go through the layouttemplates and remove the ones listed as removetemplate
                var removelist:Array = [];
                for each (var removeXML:XML in configXML.layouttemplates.removetemplate){
                    removelist.push(removeXML.toString());
                }
                
                if (removelist.length > 0){
                    var ltLen:int = layoutTemplates.length;
                    var layoutTemplate:String;
                    for (var rt:int = ltLen - 1; rt >= 0; rt--){
                        layoutTemplate = layoutTemplates.getItemAt(rt) as String;
                        if (removelist.indexOf(layoutTemplate) > -1){
                            layoutTemplates.removeItemAt(rt);
                        }
                    }
                }

                if (configXML.layouttemplates[0])
                {
                    printParameters.layoutTemplate = configXML.layouttemplates.@defaultvalue[0] || configXML.layouttemplates[0];
                    layoutTemplatesVisibility = configXML.layouttemplates[0].@visible[0] != "false";
                }
                shouldShowTemplateOptions = layoutTemplatesVisibility && (layoutTemplates && layoutTemplates.length > 1);

                var shouldUseServiceInfoDefault:Boolean = (!printParameters.layoutTemplate && serviceInfo.defaultLayoutTemplate);
                if (shouldUseServiceInfoDefault)
                {
                    layoutTemplatesDDL.selectedItem = serviceInfo.defaultLayoutTemplate;
                }
            }


In the PrintWidget.xml, forget every thing that you have previously done and do it this way:

<configuration>
    <!-- change this URL to your own Export Web Map Task (requires ArcGIS Server 10.1), or just remove the taskurl tag to get quick printing -->
    <taskurl>http://servicesbeta2.esri.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task</taskurl>
    <layouttemplates>
        <removetemplate>MAP_ONLY</removetemplate>
    </layouttemplates>
</configuration>


Don't forget to click the top arrow (promote).
Follow these steps as shown in the below graphic:

0 Kudos