Hiding selected Feature within Popup

294
3
02-19-2024 07:05 AM
Charan
by
New Contributor III

Hi Everyone,

So, Im currently able to hide the selected features by clicking ont he feature and hiding it within the custom action in the popup. However, after changing my api to 4.28, Im not able to do it anymore

 

view.when(() => {
            const oidField = "OBJECTID";
            const oidField3 = "ObjectID";
            view.popup.on("trigger-action", ({ action }) => {
              if (action.id === "hide-this") {
                const oid = view.popup.selectedFeature.attributes[oidField3];
                Amicaoids.push(oid);
                Amicaexp = `${oidField3} NOT IN (${Amicaoids.join(",")})`;
                AmicaExistingSites.definitionExpression = Amicaexp;
                view.popup.close();
              } else if (action.id === "hide-pipeline") {
                const pipeline_oid =
                  view.popup.selectedFeature.attributes[oidField];
                Pipelineoids.push(pipeline_oid);
                Pipelinexp = `${oidField} NOT IN (${Pipelineoids.join(",")})`;
                Pipeline.definitionExpression = Pipelinexp;
                view.popup.close();
              } else if (action.id === "hide-sitelog") {
                const siteLog_oid =
                  view.popup.selectedFeature.attributes[oidField];
                SiteLogoids.push(siteLog_oid);
                SiteLogexp = `${oidField} NOT IN (${SiteLogoids.join(",")})`;
                SiteLog.definitionExpression = SiteLogexp;
                view.popup.close();
              } else if (action.id === "hide-posite") {
                const posite_oid =
                  view.popup.selectedFeature.attributes[oidField];
                POSiteoids.push(posite_oid);
                POSiteexp = `${oidField} NOT IN (${POSiteoids.join(",")})`;
                POSite.definitionExpression = POSiteexp;
                view.popup.close();
              } else if (action.id === "hide-comp") {
                const existing_oid =
                  view.popup.selectedFeature.attributes[oidField3];
                CompExistingoids.push(existing_oid);
                CompExistingexp = `${oidField} NOT IN (${CompExistingoids.join(
                  ","
                )})`;
                CompetitorsExisting.definitionExpression = CompExistingexp;
                view.popup.close();
              } else if (action.id === "hide-qualified") {
                const qualified_oid =
                  view.popup.selectedFeature.attributes[oidField3];
                CompQualifiedoids.push(qualified_oid);
                CompQualifiedexp = `${oidField} NOT IN (${CompQualifiedoids.join(
                  ","
                )})`;
                CompetitorsQualified.definitionExpression = CompQualifiedexp;
                view.popup.close();
              } else if (action.id === "hide-proposed") {
                const proposed_oid =
                  view.popup.selectedFeature.attributes[oidField3];
                CompProposedoids.push(proposed_oid);
                CompProposedexp = `${oidField} NOT IN (${CompProposedoids.join(
                  ","
                )})`;
                CompetitorsProposed.definitionExpression = CompProposedexp;
                view.popup.close();
              }
            });
          });
Tags (3)
0 Kudos
3 Replies
JoelBennett
MVP Regular Contributor

Perhaps simplifying the syntax of your definition expressions might help. For example:

 

Amicaexp = oidField3 + " NOT IN(" + Amicaoids.join(",") + ")";
0 Kudos
Charan
by
New Contributor III

Hi @JoelBennett, the issue is that when I click on the popup, I don’t see the actions I have created!

0 Kudos
JoelBennett
MVP Regular Contributor

In that case, can you supply the code where you create the PopupTemplate and its actions?

0 Kudos