JS 4.x Popup content type attachment not showing when return from Search

876
8
10-20-2017 11:36 AM
DavidColey
Frequent Contributor

Hi - I've got a simple popup template defined for my feature layers in js 4.5. I've gotten around domain descriptions not returning in the popup's text content for coded values with some Arcade, but when the popup displays after the Search return, it does not display Attachments.  The popup template displays both content types when returned from a view click.  Feels like a bug to me:

plySearchTem = new PopupTemplate({
    title: "{expression/pgmArea} Project",
    content: [{ 
       type: "text",
       text: "<b>Name:</b> {ProjectName}" +
                "<br><b>CIP#:</b> {ProjectID}" + 
                "<br><b>Status:</b> {expression/lStatus}"
       }, {
       type: "attachments"
       }],
    expressionInfos:[{
       name: "pgmArea",
       expression: "When($feature.ProgramArea == 'EI', 'Environmental', $feature.ProgramArea == 'F', 'Facilities',       $feature.ProgramArea == 'M', 'Mobility', $feature.ProgramArea == 'U', 'Utilities', 'Capital')"
       },{
       name: "lStatus",
       expression: "When($feature.LifeCycleStatus == 'ACT', 'Active', $feature.LifeCycleStatus == 'PRP', 'Proposed',       $feature.LifeCycleStatus == 'CAN', 'Canceled', $feature.LifeCycleStatus == 'CLS', 'Closed', 'Other')" 
    }],
    overwriteActions: true
    //dockOptions: app.dockOptions*/
 });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

And my search:

app.search = new Search({
    container: "searchWidgetDiv",
    view: app.mapView,
    allPlaceholder: "Find Addresses / Projects",
    sources: [{
       locator: new Locator("https://ags2.scgov.net/arcgis/rest/services/WebPointLocator/GeocodeServer"),
       singleLineFieldName: "Single Line Input", //Single Line Input
       name: "Search by Address",
       localSearchOptions: {
       minScale: 300000,
       distance: 10
    },
       placeholder: "Search by Address",
    }, {
       featureLayer: capSearch,
       popup: plySearchTem, //only seems to honor when layer is part of view's added layers?
       //popupOpenOnSelect: true,
       //resultGraphicEnabled: true,
       resultSymbol: new SimpleFillSymbol({
          color: [255,255,0,0.0],
          style: "solid",
          outline: {
             color: [102,0,204],
             width: 5
          }
   }),
    searchFields: ["ProjectName"],
    displayField: "ProjectName",
    exactMatch: false,
    outFields: capFields,
    name: "Search by Project Name",
    placeholder: "Search by Project",
    }]
}); // Add the search widget to the navbar ,"searchWidgetDiv"‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Any ideas?

Thanks,

David

Tags (1)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

David,

   I was not aware that you could ever get attachment to display in the search widget results popup.

0 Kudos
DavidColey
Frequent Contributor

Well, attachments return in my 3.x version so I thought that if the content were defined correctly it would work at 4.x

0 Kudos
DavidColey
Frequent Contributor

I'm sorry, I should add that since I hadn't ready anything to the contrary in the 4.x help that I did think the attachments would return

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

David,

   4.x has a way to go yet and if there is not something in the doc that say it works that way then you should assume that it does not (yet).

0 Kudos
ThomasSolow
Occasional Contributor III

I'm not aware of a way to query features and ask for attachments in the same request (though that sounds pretty nice...), so multiple requests are most likely required for this.  My bet is that the search widget just hasn't been set up to take care of this yet.

DavidColey
Frequent Contributor

Thanks Thomas, but that's not really what I am asking.  Are you saying that a mouse-click or mouse-over event on a feature layer is performing multiple requests and that is why multiple content types can be displayed in the 4.x popup?  But that is then not the case when that same popup is returned from the search?

0 Kudos
ThomasSolow
Occasional Contributor III

Yeah, that's what I meant.

0 Kudos
DavidColey
Frequent Contributor

Ok yes thanks I see.  Yes it will be nice if this will be written in at some point.

0 Kudos