Search Widget: Is it possible to open the search results in Attribute Table?

1409
8
10-18-2017 08:53 AM
RogerF
by
Occasional Contributor

I want to configure search widget for all layers in map. Right now, it searches for pre-configured layers and pre-configured columns. Is it possible to configure it for all columns of all layers ? 

Also how do I display the search results in attribute table ?

Thank you,

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Roger,

  I suppose it would be possible, just impractical and would require a bit of coding. To open the results in the AT widget you would have to create a FeatureLayer from the results and open it in the AT widget just like did in your other thread.

RogerF
by
Occasional Contributor

I was able to do that by making following changes in widget.js file of search widget

Now only problem with this approach is, it displays search results in attribute tables after it finishes searching all the layers configured in search widget and it is taking more time (more than 1 minute sometimes) I wanted to check if there is any way to do this sequentially. i.e displaying search results in attribute table layer by layer.

mdriscoll_gis 

rscheitlin

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Roger,

   It is no clear from your code which function are you adding this code to?.. Is it the _onSearchResults, _onSuggestResults or _onSelectSearchResult?

0 Kudos
RogerF
by
Occasional Contributor

in _onSearchResults function

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Roger,

   You would need to move your code up into the:

for(var i in results) {

for loop then.

0 Kudos
RogerF
by
Occasional Contributor

Robert,

_onSearchResults function is called after search is finished. 'evt' object has seachresults object and search string. 

 

I have configured all layers of my webmap in search widget (around 30). It takes around 35-45 seconds to finish search on all the layers and then it returns all results at once in _onSearchResults function. Because of this behavior, user has to wait for that much time.  Instead I wanted to check if there is anyway to get search result one by one and process it. In that way, atleast user can see the progress instead of waiting for all the search results at once.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Roger,

  Since there is not another event to attach to the fire after each source is searched the answer is no.

JaysonLindahl
Occasional Contributor

Roger,

I'm running into some issues when trying to get your solution to work.  It looks like it crashes when it gets to the following line item: featureSetAndLayerObj.featureSet = new FeatureSet();

0 Kudos