I am getting a weird result when I search for a location.
I have the Editor widget and Search basic combined.
When I search for a location, I can zoom to it. Then when I click on any other point to edit it, I get this result:
Has anyone dealt with this?
i think I am looking for a way to clear search when I click anywhere not the search point.
Even when I clear the search bar I still cannot click on a point to edit:
Solved! Go to Solution.
Robert!
I figured out a way around it!!!!!
var search = new Search({ map: map, enableButtonMode: true, enableInfoWindow: false, enableHighlight: false, enableLabel: false }, "search"); search.startup();
I stopped the Infowindow from opening which is why it was not working in the first place.
Since I answered the question I will make mine as correct but thank you so much for the help through this process!
Rickey,
This is a known feature with the API and you have to re-initialize the editor widget to overwrite the changes to the popup made by the search widget. I have seen a couple of threads on this but I don't have the links off hand.
Robert,
Thank you I will search harder for them
I have searched for an example for a few hours and cannot find any.
Here is the thread with the advice from Kelly:
Bug? Editor Widget & Search Widget not playing nice together
Rickey,
Did the link I provided answer your question?
Robert,
Sort of, I got the search to clear, but I cannot get the editor to reinitialize.
I am still working with the code.
Robert,
I am getting hung up on the destroyEditor part.
var search = new Search({ map: map }, "search"); search.startup(); search.on("select-result", lang.hitch(this, function () { //if edit tool is enabled we'll have to delete/create //so info window behaves correctly. on.once(this.map.infoWindow, "hide", lang.hitch(this, function () { search.clearGraphics(); console.log("Cleared Search Graphics"); _destroyEditor(); console.log("Test"); initEditing(); })); })); function _destroyEditor() { if (this.editor) { this.editor.destroy(); console.log("Destroyed editor"); this.editor = null; } } function initEditing(event) { var featureLayerInfos = arrayUtils.map(event.layers, function (layer) { return { "featureLayer": layer.layer, "isEditable": true, 'showAttachments': true, "showDeleteButton": false, "fieldInfos": [{ 'fieldName': 'Caller_Name', 'isEditable': false, 'tooltip': 'Caller Name', 'label': 'Caller Name:' }, { 'fieldName': 'Priority', 'isEditable': true, 'tooltip': 'Priority', 'label': 'Priority:' }, { 'fieldName': 'Location', 'isEditable': false, 'label': 'Location:' }, { 'fieldName': 'Phone', 'isEditable': false, 'label': 'Phone:' }, { 'fieldName': 'Notes', 'isEditable': true, 'label': 'Notes:' }, { 'fieldName': 'CallType', 'isEditable': true, 'label': 'CallType:' }] }; }); var settings = { map: map, layerInfos: featureLayerInfos }; var params = { settings: settings }; var editorWidget = new Editor(params, 'editorDiv'); editorWidget.startup(); //snapping defaults to Cmd key in Mac & Ctrl in PC. //specify "snapKey" option only if you want a different key combination for snapping map.enableSnapping(); }
Rickey,
You are creating a local var for your editor when you init your editor and the example Kelly is using creates a global var for the editor called this.editor
Robert,
I mostly realize what is happening, I just am not 100% sure how to fix it.
What is happening now is that when the editor tries to reinitialize I get this error:
Uncaught TypeError: Cannot read property 'layers' of undefined
I realize that this:
var featureLayerInfos = arrayUtils.map(event.layers, function (layer) {
is a local variable but I am unsure how to make it global.