on(this.map.infoWindow, 'SelectionChange', lang.hitch(this, function() { var g = this.map.infoWindow.getSelectedFeature(); if (g) { var options = { graphic: g }; var cit = new ClipboardInfoTemplate(options, domConstruct.create("div")); cit.startup(); this.map.infoWindow.setContent(cit.domNode); } }));Solved! Go to Solution.
have you tried console.dir(g) to output the complete feature? My guess is there is an attribute in there that will provide you with the layername
{
[functions]: ,
__proto__: {
[functions]: ,
__proto__: { },
_graphicsLayer: null,
_shape: null,
_visible: true,
declaredClass: "esri.Graphic",
visible: true
},
_graphicsLayer: null,
_shape: null,
_visible: true,
attributes: {
[functions]: ,
__proto__: {
[functions]: ,
__proto__: null
},
datalink: "value",
dateposted: "2/22/2012",
Intersection: "y",
intid: "Value",
measure: "2.0869",
OBJECTID: "2",
other: "Null",
postedby: "kdl",
RID: "8",
Road: "Value",
road2: "Value",
SHAPE: "Point",
studydate: "2/9/2012"
},
declaredClass: "esri.Graphic",
geometry: { },
infoTemplate: {
[functions]: ,
-chains-: { },
__proto__: { },
_dateFormats: { },
_fieldLabels: { },
_fieldsMap: { },
chartTheme: null,
declaredClass: "esri.dijit.PopupTemplate",
info: {
[functions]: ,
__proto__: { },
description: "OBJECTID = 2<br/>SHAPE = Point<br/>Road = Value<br/>Intersection = y<br/>road2 = Value<br/>other = Null<br/>studydate = 2/9/2012<br/>datalink = Value<br/>dateposted = 2/22/2012<br/>postedby = kdl<br/>measure = 2.0869<br/>intid = Value<br/>RID = 8<br/>",
title: "KDOT Traffic Counts Intersections"
}
},
symbol: null,
visible: true
}
var attrs = content;
//do some overrides
var contentreplacement = SearchParams.resultContentOverride(attrs.content, result.layers, f);
attrs.content = contentreplacement;
//add some links
attrs.links = links;
//override title
attrs.titleField = titleField;
//modify content only in result table
var fieldInfos = [];
array.forEach(fieldNames, function(name) {
fieldInfos.push({
fieldName: name, visible: true
});
});
// alert(fieldInfos);
var g = new esri.Graphic(f.geometry, sym, attrs);
g.setInfoTemplate(new esri.dijit.PopupTemplate({
title: title,
fieldInfos: fieldInfos
}));
my recommendation would be to add the layer info to the attributes of the popup when you set itvar attrs = content; //do some overrides var contentreplacement = SearchParams.resultContentOverride(attrs.content, result.layers, f); attrs.content = contentreplacement; //add some links attrs.links = links; //override title attrs.titleField = titleField; //modify content only in result table var fieldInfos = []; array.forEach(fieldNames, function(name) { fieldInfos.push({ fieldName: name, visible: true }); }); // alert(fieldInfos); var g = new esri.Graphic(f.geometry, sym, attrs); g.setInfoTemplate(new esri.dijit.PopupTemplate({ title: title, fieldInfos: fieldInfos }));