cmv/cmv-app

After Apply UniqueValueRenderer to feature layer Print widget is not working ?

mayur9785 opened this issue · 1 comments

Hi,
If I don't include renderer widget (include:false) in viewer.js file then print widget is working.
If I include renderer widget (include: true) in viewer.js file then print is not working.
Below is my OperationalLayer Feature Layer in viewer.js

    {
            type: 'feature',
            url: 'http://serviceurl/arcgis/rest/services/BPDHCDMS/GIS_MAP/MapServer/0',
            title: "Status",
            options: {
                id: 'status',
                opacity: 1.0,
                visible: true,
                outFields: ['*'],
                mode: 1
            },
        },

UniqueValueRenderer widget in Viewer.js file

renderer: {
                include: true,
                id: 'renderer',
                type: 'invisible',
                path: 'dijit/_WidgetBase',
                options: {
                    map: true,
                    startup: function () {
                        var renderer = this.createRenderer();
                        var featureLayer = this.map.getLayer('status');
                        featureLayer.setRenderer(renderer);
                    },
                    createRenderer: function () {
                        var defaultSymbol = new SimpleFillSymbol().setStyle(SimpleFillSymbol.STYLE_NULL);
                        defaultSymbol.outline.setStyle(SimpleLineSymbol.STYLE_NULL);

                        //create renderer
                        var renderer = new UniqueValueRenderer(defaultSymbol, 'BPDHC.DASHBOARD.STATUS_ID');

                        //add symbol for each possible value
                        renderer.addValue({
                            value: "10",
                            symbol: this.createSymbol("#3A8AE0"),
                            label: "Preliminary Survey"
                        });
                        renderer.addValue({
                            value: "13",
                            symbol: this.createSymbol("#ff0000"),
                            label: "Pre Survey Rejected"
                        });
                        renderer.addValue({
                            value: "15",
                            symbol: this.createSymbol("#FF0000"),
                            label: "Preliminary Survey - On Hold"
                        });
                        renderer.addValue({
                            value: "20",
                            symbol: this.createSymbol("#7030a0"),
                            label: "Final Survey Assignment"
                        });
                        renderer.addValue({
                            value: "30",
                            symbol: this.createSymbol("#0070c0"),
                            label: "Final Survey"
                        });
                        renderer.addValue({
                            value: "31",
                            symbol: this.createSymbol("#ff0000"),
                            label: "Final Survey On Hold"
                        });
                        renderer.addValue({
                            value: "40",
                            symbol: this.createSymbol("#00b050"),
                            label: "Final Survey - QS Check"
                        });
                        renderer.addValue({
                            value: "50",
                            symbol: this.createSymbol("#7030a0"),
                            label: "Final Survey Approval"
                        });
                        renderer.addValue({
                            value: "41",
                            symbol: this.createSymbol("#0070c0"),
                            label: "Contractor/RO Assignment"
                        });
                        renderer.addValue({
                            value: "42",
                            symbol: this.createSymbol("#FF0000"),
                            label: "Contractor/RO Assignment On Hold"
                        });
                        renderer.addValue({
                            value: "60",
                            symbol: this.createSymbol("#0070c0"),
                            label: "RO Processing"
                        });
                        renderer.addValue({
                            value: "70",
                            symbol: this.createSymbol("#8a3674"),
                            label: "Inspector Assignment"
                        });
                        renderer.addValue({
                            value: "80",
                            symbol: this.createSymbol("#00b050"),
                            label: "Inspections"
                        });
                        renderer.addValue({
                            value: "150",
                            symbol: this.createSymbol("#ff0000"),
                            label: "House Connection Completed"
                        });
                        renderer.addValue({
                            value: "160",
                            symbol: this.createSymbol("#ff0000"),
                            label: "Work Cancelled"
                        });
                        renderer.addValue({
                            value: "300",
                            symbol: this.createSymbol("#ff0000"),
                            label: "Not Approved"
                        });
                        return renderer;
                    },
                        createSymbol: function (color) {
                            return new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color("#000"), 0.5), new Color(color));
                        }
                    }
                }

This is print widget Output when I don't include renderer widget

print

When I include renderer widgets I am getting error.

print3

print4

Thanks,

@mayur9785 Since a request is made to the Service, I don't think the problem is in the Print widget. Possible in the renderer itself. This error suggests either an issue in the formation of the request sent to the Print Service on the server or the Print Service is having difficulty processing the request. Maybe it is choking on some of your field values that are the basis of your renderer. You'll need to work with the REST end-point for the Service to see if you can determine the cause.

NOTE: I am assuming the CORS error is unrelated to this ussue. Could be wrong about that...