Hi there. I'm building a simple ExB app and have two issues with the Search widget which may be related (if not, I can post them separately). The widget is looking at two different data sources: a map layer and World Geocoding Service.
Am I missing some configuration option to address one or both of these issues? If not, I can add these as Ideas.
Thanks!
Derek
Solved! Go to Solution.
Problem 1 is an easy fix. In the builder mode, open up the search result options and check 'Auto Select First Result'.
Problem 2 is some bad design on ESRI's part. I have a fix if you are using developer edition. Open the result-list.tsx, find the onSelectRecord function and add onShowResultButtonclick()
Hi @DerekMStrout,
I've also noticed this, would be useful if this widget is edited.
Thank you,
Problem 1 is an easy fix. In the builder mode, open up the search result options and check 'Auto Select First Result'.
Problem 2 is some bad design on ESRI's part. I have a fix if you are using developer edition. Open the result-list.tsx, find the onSelectRecord function and add onShowResultButtonclick()
Wow, @JeffreyThompson2, Problem 1 seems to be working now. I swear it wasn't before, and I had "Auto Select First Result" checked. And we are using the standard ExB version (for now at least), so hopefully this is a popular request and can get implemented. Thanks for the help!
Would you happen to know why the Search widget is not selecting the matching feature when I have the result panel turned off, but works fine when it is turned on?
My experience has 2 maps, the one users interact with and one I'm using for all the fun back end stuff. The search widget is tied to a dedicated search layer in the backend map, and any selection of a feature from the Search layer is tied by actions to the layer controlling the popup as well as the corresponding feature in the user map. With the result panel turned on, it all works as expected with no snags I've come across. However, when I turn that off (so my non-empty searches can open the correct Section View) nothing happens.
Hi Jeffrey, I just wanted to say thanks for posting this as its incredibly useful. I have the same issue, and I was wondering if you could post your copy of the result-list.tsx file as I'm not totally clear what changes to make.
Thanks in advance, this is a big help.
Best wishes,
John
In the picture above there is a toggle switch to turn off the Result Panel, as of the latest version of ArcGIS Online, this option actually works and you can use the Search Widget with the Results Panel turned off. This should be in Developer Edition 1.16 in a week or two.
The result-list.tsx file is very long. Posting it all really wouldn't be very useful. There is a Search Widget with this modification in this package. https://community.esri.com/t5/experience-builder-custom-widgets/identify-for-experience-builder-1-14...
And this post goes into some more detail about what modifications were made and how. https://community.esri.com/t5/experience-builder-tips-and-tricks/modifying-esri-widgets-and-making-t...
Thanks Jeff, this is brilliant! I really appreciate the help. I followed the instructions and updated the result_list.tsx based on your code but it doesn't seem to work. My code update is below if you have time to run your eyes over it and tell me what I've done wrong. I think I may owe you some Irish Whiskey for this 😀
This is the code change I made as a result to the file at C:\ArcGis\ArcGisExperienceBuilder115\client\your-extensions\widgets\searchcustom\src\runtime\component\result_list.tsx (code change highlighted in bold)
const onSelectRecord = hooks.useEventCallback((option: SelectRecordsOption) => {
const { isActive, recordId, dsId, configId } = option
const localDsId = displayRecordRef.current?.[configId]?.[0]?.localDsId
const isGeocodeRecords = displayRecordRef.current?.[configId]?.[0]?.isGeocodeRecords
const datasourceId = isGeocodeRecords ? dsId : localDsId
const ds = getDatasource(datasourceId) as QueriableDataSource
//Publish message action
const records = !isActive ? getRecordsByRecordsId(configId, recordId) : []
// const widgetId = isGeocodeRecords ? id : localId
MessageManager.getInstance().publishMessage(
new DataRecordsSelectionChangeMessage(id, records)
)
handleDsIdOfSelectedResultItemChange(recordId ? dsId : null)
if (recordId) {
!isActive && clearOtherDsSlectedRecords(configId)
!isActive ? ds?.selectRecordsByIds([recordId]) : ds?.selectRecordsByIds([])
}
//Closes search result panel
onShowResultButtonclick()
})
It's been a couple editions since I've done this, so it's possible there has been a code change along the way that broke this one line fix. I don't see any issue in the code you posted. If you turned off the Result Panel Toggle in the Build Mode try turning it back on.
Developer Edition 1.16 should be released today and it will make turning off the result panel a standard option.
In AGOL search bar finds the main address on the parcel but the results panel is set to auto-select and zooms to one of the unit address on the parcel. Is there a way to setup sort or assign priority based on an attribute type?