Select to view content in your preferred language

Failed to search multiple search sources with ArcGIS Map JavaScript SDK 4.31

338
2
Jump to solution
11-17-2024 01:33 PM
TedZhou
Occasional Contributor

The ArcGIS JavaScript SDK mentioned SearchViewModel as below:

SearchViewModel | API Reference | ArcGIS Maps SDK for JavaScript 4.31 | Esri Developer

 

 

 

activeSourceIndex
 
PropertyactiveSourceIndex Number

The selected source's index. This value is -1 when all sources are selected.

Default Value:0
 
 
 
I tried not a few times with multiple sources and set activeSourceIndex = -1, it actually only searches the first source at the list.
 
Not sure 1. Anything I might do incorrectly, 2. The server we connected to not set up properly,  or 3. ArcGIS JavaScript SDK (version 4.31) not supporting the multiple search sources?
 
Massive thanks for your kind tips.
 
Ted
 

 

 

0 Kudos
1 Solution

Accepted Solutions
TedZhou
Occasional Contributor

Sorry for my post. I did mis firing. 

It works as expected actually. 

Just configuring the multiple search sources within search view model and set the "activeSourceIndex = -1" then you could do multiple source search. 

Sorry for my mis firing. 

 

 

View solution in original post

0 Kudos
2 Replies
TedZhou
Occasional Contributor

Search widget with multiple sources | Sample Code | ArcGIS Maps SDK for JavaScript 4.31 | Esri Devel...

The search widget works perfectly with multiple search sources.

Not sure what "All" menu did with searchViewModel internally?

How could we only change searchViewModel or search without the popup template to select "All" to get the search multiple search sources working? Probably only change "activeSourceIndex = -1" is not enough?

 

The pop up "All" menu probably did more than "activeSourceIndex = -1" to get the multiple search sources working perfectly?

 

Thanks

 

 

0 Kudos
TedZhou
Occasional Contributor

Sorry for my post. I did mis firing. 

It works as expected actually. 

Just configuring the multiple search sources within search view model and set the "activeSourceIndex = -1" then you could do multiple source search. 

Sorry for my mis firing. 

 

 

0 Kudos