Search Widget Set Extent

357
1
Jump to solution
05-30-2023 06:18 PM
LillieCollins
New Contributor

Hello, I am updating one of my legacy applications and I used to do this to set the extent for the search widget: Search widget | Guide | ArcGIS API for JavaScript 3.43 | ArcGIS Developer but I do not see a link to how to do it using the new Version of the API for 4.26. Is it just as simple as this?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

As shown in the 3.x documentation you linked to, setting the extent for a source looked like this:

search.sources[0].searchExtent = extent;

 

In 4.x, it would look like this:

search.sources.getItemAt(0).filter = {geometry:extent};

 

See also Search.sources and LayerSearchSource.filter.

View solution in original post

1 Reply
JoelBennett
MVP Regular Contributor

As shown in the 3.x documentation you linked to, setting the extent for a source looked like this:

search.sources[0].searchExtent = extent;

 

In 4.x, it would look like this:

search.sources.getItemAt(0).filter = {geometry:extent};

 

See also Search.sources and LayerSearchSource.filter.