Extend Enhanced Search Widget

4417
20
Jump to solution
04-13-2016 03:13 PM
soniamonga
New Contributor II

Robert,  I have task where I need to select a predefined value from a drop down, and based on that value it queries the underlying layers. Your widget works great if I have to query a single layer. Can anyone of you suggest a sample or a widget that I could use?

Thanks

Sonia

Tags (1)
0 Kudos
20 Replies
RobertScheitlin__GISP
MVP Emeritus

Sonia,

Can I see your current code where you define the feature layer and its out fields?

0 Kudos
soniamonga
New Contributor II

Robert, I have attached the code for your reference. Thanks again for all your help!!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sonia,

  You have to use the proper case for your field names JS is a case sensitive language.

query.outFields = ["SORT_TEXT","CITY", "COUNTY"];

0 Kudos
soniamonga
New Contributor II

Ok. let me try that. Any idea on the refresh part? When I select a new county from the drop down it doesn’t remove/refresh the previous selection. I might have removed the reset function from the code.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sonia,

Are you using FeatureLayer.clearSelection()?

0 Kudos
soniamonga
New Contributor II

Yes. I have tried that.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sonia,

  Not sure what to tell you then as

featureLayer1.clearSelection(); should work.

0 Kudos
soniamonga
New Contributor II

Robert, I have struggled over the weekend on this.. The featureLayer1.clearSelection() does work but looks like I am not passing it at the correct location. Would you please take a stab at the code and see which function and how I should be using it?

Thanks so much…..

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sonia,

When you want a var available in any function in the widget you define it this way:

return declare([BaseWidget, _WidgetsInTemplateMixin], {

    // DemoWidget code goes here 
    baseClass: 'jimu-widget-demo',
    zipcodes1: null,

    startup: function() {
        this.inherited(arguments);
        console.log('startup');
        //var zipcodes1;
    },

    _onchgclearfeatures: function() {
        alert("clear");
        this.zipcodes1.clearSelection();
    },
soniamonga
New Contributor II

Thanks so much Robert for all your help so far!

0 Kudos