Filter Widget - Remove Filters for Missing Layers

275
1
03-04-2020 08:43 AM
Status: Open
KeithGerhartz1
Occasional Contributor II

Other widgets omit references to layers if they are missing. For example, if a layer does not load, then it will not appear in the layer widget, the batch editing widget, etc. This is not the case with the filter widget. The associated filter will still appear with a message that the layer could not be loaded. Would be better if it did not display at all.

1 Comment
KeithGerhartz1

For what it is worth. You can add one line of code to the filter widget javascript file to hide filter nodes for layers that are missing in the map.

_setFilterNodeError: function(node, layerId){
//remove arrow-icon, disable toggle-btn, add warnning-icon
var errorTitle = this.jimuNls.map.layerLoadedError.replace('${layers}', layerId);
html.setAttr(node, 'aria-disabled', 'true');
html.removeClass(node, 'config-parameters');
html.removeClass(node, 'has-ask-for-value');
html.addClass(node, 'not-has-ask-for-value');

//Added by K Gerhartz to remove filters that are associated with layers that are not present in the map
html.setStyle(node, 'display', 'none');

//change arrow to error
var arrow = query('.arrow', node)[0];
html.removeClass(arrow, 'arrow');
html.addClass(arrow, 'error');
html.setAttr(arrow, 'title', errorTitle);
html.setStyle(arrow, 'display', 'block');
},