green3g / cmv-widgets

Dojo Widgets to extend the functionality of CMV
https://roemhildtg.github.io/cmv-widgets/
MIT License
19 stars 29 forks source link

Label Widget field list gets appended to #38

Open kjohnsonGIS opened 6 years ago

kjohnsonGIS commented 6 years ago

Hi, I'm noticing on the label widget, after choosing to label a field on a certain layer, then choosing a different layer, the field list contains the fields of the first layer and the second. Just wondering if this has been noticed before and if i'm doing something wrong in the config.
Heres my current config:

            labelLayer: {
                title: 'Map Labels',
                id: 'labelLayer',
                include: true,
                type: 'titlePane', //titlePane
                position: 15,
                path: 'gis/dijit/Widgets/LabelLayer',
                options: {
                    // required!
                    map: true,
                    layerControlLayerInfos: true,
                    labelInfos: {
                      private: { // a string like 'assets'
                        exclude: true  //, // exclude this entire layer
                      },
                      BasemapLabels:{
                        exclude:false, 
                        4:{
                            exclude: false, 
                            fields:[{
                                alias: 'PIN',
                                name: 'PIN'
                            },{
                                alias: 'LASTNAME',
                                name: 'LASTNAME'
                            },{
                                alias: 'LOT',
                                name:'LOT'
                            }]
                        },
                        3:{
                            exclude: true
                        },
                        2: {
                            exclude: true
                        },
                        0: {
                            exclude: true
                        },
                        1: {
                            exclude: false
                        },
                        5: {
                            exclude: false
                        }
                      },
                      conservation: {
                          exclude: true
                      },
                      gps: {
                          exclude:true
                      },
                      regionalgeography: {
                          exclude:true
                      },
                      boundaries: {
                          exclude: true
                      },
                      parcels: {
                          exclude: true
                      },
                      distribution: {
                          exclude:true
                      }

                    }
                }
            }  

BTW this is a great widget, i see it being super useful to our users! Thanks!

green3g commented 6 years ago

Hm, I'm not super familiar with the code anymore but try this:

Add

this.emptyStore(this.labelSelectionStore);

to the start of this function here: https://github.com/roemhildtg/cmv-widgets/blob/master/widgets/LabelLayer.js#L207

Let me know if that fixes it

kjohnsonGIS commented 6 years ago

Thanks for getting back to me! That did the trick! Thank you!