Hi there,
is it possible to reduce the symbols in the WAB Editor Widget?
I have symbols in different states (e.g 1,2,3) and when opened the widget, only symbols with state 1 should be shown and be creatable.
The changes to 2 or 3 should be changeable within the value of field, which is responsible for the symbol.
Thanks in advance,
Karsten
Solved! Go to Solution.
Karsten,
you can also do that in the webmap.
If you use ArcGIS Pro you can delete the Symbols from the feature template before sharing the map or layer.
Karsten,
Sure you can. Here is the Edit widgets Widget.js _getTemplatePicker function updated to filter items based on a hard coded string (line 31 - 49 added): The filter term is 'Robbery' in line 39.
_getTemplatePicker: function(layerInfos) {
this._layerObjectsParaForTempaltePicker = [];
array.forEach(layerInfos, function(layerInfo) {
if(layerInfo.featureLayer &&
layerInfo.featureLayer.getEditCapabilities &&
layerInfo.featureLayer.getEditCapabilities().canCreate) {
this._layerObjectsParaForTempaltePicker.push(layerInfo.featureLayer);
}
}, this);
// change string of templatePicker is empty
this._defaultTempaltePickerEmpeyStr =
esriBundle.widgets.templatePicker.creationDisabled;
if(this._canCreateLayersAreAllInvisibleFlag) {
esriBundle.widgets.templatePicker.creationDisabled =
this.nls.noCanCreateLayerAreCurrentlyVisible;
}
var bottomStyle = this._configEditor.toolbarVisible ? "" : "bottom: 0px";
var topStyle = this._configEditor.useFilterEdit ? "top: 115px" : "top: 18px";
var templatePicker = new TemplatePicker({
featureLayers: this._layerObjectsParaForTempaltePicker,
grouping: true,
rows: "auto",
columns: "auto",
style: bottomStyle + ";" + topStyle
}, html.create("div", {}, this.domNode));
templatePicker.startup();
var origFunc = templatePicker.constructor.prototype._getItemsFromLayer;
templatePicker._getItemsFromLayer = lang.hitch(this, function () {
var items;
items = origFunc.apply(templatePicker, arguments);
items = array.filter(items, function (item) {
var match = false;
var regex = new RegExp('Robbery', "ig");
if (regex.test(item.label)) {
console.log("item = ", item);
match = true;
}
return match;
});
return items;
});
return templatePicker;
},
Thank you rscheitlin, but is it also possible without changing the code?
Not that I am aware of.
Karsten,
you can also do that in the webmap.
If you use ArcGIS Pro you can delete the Symbols from the feature template before sharing the map or layer.
Thank you raweipol! This is the solution I searched!