Search with Expand

662
2
Jump to solution
10-09-2019 12:54 PM
AshleyPeters
Occasional Contributor III

I need to add some additional functionality to a map, namely the search widget. To keep the screen open, I want to use Expand with it. However, as soon as I add Expand in, the search widget no longer functions properly. The widget stays collapsed and never allows the user to search. Here's that portion of my code. Am I missing something?

//Add search widget	
	var searchWidget = new Search({
          view: view,
		});
		
	var searchExpand = new Expand({
	view: view,
	content: searchWidget.domNode,
	expandIconClass: "esri-icon-search"
	});
        
		// Add the search widget to the top left corner of the view
        view.ui.add(searchExpand, "top-right");

Thanks in advance for any guidance!

Ashley

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ashley,

    You need to add the whole search widget as the expands content not just the domNode.

        var searchExpand = new Expand({
          view: view,
          content: searchWidget,
          expandIconClass: "esri-icon-search"
        });

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Ashley,

    You need to add the whole search widget as the expands content not just the domNode.

        var searchExpand = new Expand({
          view: view,
          content: searchWidget,
          expandIconClass: "esri-icon-search"
        });
AshleyPeters
Occasional Contributor III

Thanks Robert! That was my problem.

0 Kudos