Attempting to use custom code in the Smart Editor widget, so that save button has an onclick that closes the editor entirely (instead of bringing it back to template) after save and would greatly appreciate a little direction on where it might go (not terribly familiar with JS), I am working in the Smart Editor Widget.js file and tried pasting in
PanelManager.getInstance().closePanel(widgetid + ‘_panel’);
I included the Define and the Function, but it inst working where I've been placing it. Have I botched the syntax?
Does anyone have a sample I could refer to?
Solved! Go to Solution.
Jeff,
That sounds like PanelManager is null in your codes scope. So where is the PanelManager var created?
Jeff,
Do you have a local variable called widgetid? That’s probably your issue if not.
I think i have isolated the piece of code in the Widget.js that needs to be modified
this.own(on(saveButton, "click", lang.hitch(this, function () {
if (!this._validateFeatureChanged()) {
this._resetEditingVariables();
return;
}
if (this.map.infoWindow.isShowing) {
this.map.infoWindow.hide();
}
this._saveEdit(this.currentFeature);
I am currently using the widgetID from the WebApp's config.json file i have added the following line after line 9:
PanelManager.closePanel(widgets_SmartEditor_Widget_22 + '_panel');
Nothing happens (except a browser developer tool error pops up saying PanelManager.closePanel is not a function)
Jeff,
That sounds like PanelManager is null in your codes scope. So where is the PanelManager var created?
I was able to get this to work with your insightful response! I had neglected to create the variables
Am I going about this the wrong way? I'm attempting to close the edit widget and end the editing session. the window closes...but i'm still in edit mode for all intents and purposes (ie: anything i click becomes selected for editing, instead of InfoWindow loading.)
Jeff,
I think you have to call the widgets close method. I will look into this.
Jeff,
Strange it took a little fiddling.
this.own(on(saveButton, "click", lang.hitch(this, function () {
if (!this._validateFeatureChanged()) {
this._resetEditingVariables();
return;
}
if (this.map.infoWindow.isShowing) {
this.map.infoWindow.hide();
}
this._saveEdit(this.currentFeature);
setTimeout(lang.hitch(this, function(){
PanelManager.getInstance().closePanel(this.id + '_panel');
this._cancelEditingFeature(true);
}), 300);
})));
this is awesome, closing and infowindow selection work flawlessly.
the widget is nonfunctional after save/closing though (after the initial save, editing a point results in an unending loadscreen). i'll keep tinkering with these functions and see if i can find one that resets the panel.