To conceal a row in ArcGIS JavaScript API 4.x using PopupTemplate, you need to set up a script that will check if the attribute value is equal to a certain value, and then hide the row accordingly.
Here's an example code:
// Set up a PopupTemplate for your layer
var template = new PopupTemplate({
title: "{Name}",
content: [{
// Add a field for the attribute you want to check
type: "fields",
fieldInfos: [{
fieldName: "Attribute_Name",
visible: true,
// Use the "visibleWhen" property to set up your condition
visibleWhen: "{Attribute_Name} != 'Value_to_hide'"
}]
}]
});
// Create the layer and apply the PopupTemplate
var layer = new FeatureLayer({
url: "Layer_URL",
popupTemplate: template
});
// Add the layer to your Map
map.add(layer);
In the above code, the PopupTemplate will only display the attribute row if the value of "AttributeName" is not equal to "Valueto_hide". If it is, the row will be hidden. You can adjust the condition to fit your needs.
Note that this approach only hides the row in the PopupTemplate, not the actual data itself. If you want to hide the data, you'll need to apply a filter to your layer.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-02 08:24:45 +0000
Seen: 7 times
Last updated: Jun 02 '23
Is it feasible to utilize a Toggle Button to switch among multiple classes exceeding 2?
What is the process for generating a dynamic subdomain/URL using vue.js?
How can I create a transition on click using CSS without the need for JavaScript?
How can the style of the loader be modified while the form submission is being processed?
I'm attempting to develop a Javascript-based comments section for my website.
What are some feasible methods to enable MIDI file playback on a web browser?