eSearch: get value of currently selected search layer

746
4
Jump to solution
12-04-2020 05:09 AM
JamesCrandall
MVP Frequent Contributor

This is cross post from "Documents" section (sorry about that getting used to new forum).

 

From the Widget.js of the eSearch, what is the best way to get the value from the currently selected value in the search layer drop down list?

Thanks!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

James,

   If I am understanding your question correctly you are asking to know which search Layer is selected.

 To get the index:

this.AttributeLayerIndex

If you want the actual layer object then:

this.config.layers[this.AttributeLayerIndex]

If you just want the text/name then:

this.selectLayerAttribute.get('value')

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

James,

   If I am understanding your question correctly you are asking to know which search Layer is selected.

 To get the index:

this.AttributeLayerIndex

If you want the actual layer object then:

this.config.layers[this.AttributeLayerIndex]

If you just want the text/name then:

this.selectLayerAttribute.get('value')
JamesCrandall
MVP Frequent Contributor

I think that will do it.  I was expecting the text value of the selected search layer but get it's index.  Not a big deal, I can work with this!  Thank you Robert!

 

(I need to get better at inspecting elements and locating them, not sure why I struggle with this!)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

James,

 

   The third option I provided should give you the text.

JamesCrandall
MVP Frequent Contributor

That's the one I used but gives the index.  Perfectly fine with me, it's actually preferable in case search layer names get changed but I just have to be careful not to shuffle things around without updating some conditional logic I have added.

All good -- thanks again Robert!

0 Kudos