Closed james-rae closed 1 year ago
While I'm framing this as a mapping problem, the solution might be really easy.
In the grid method const openDetails
, instead of stripping data from the rows, doing reverse mapping, and removing custom grid fields, we could simplify to something like
// similar to the sql lookup, the details panel must use the original OID field to render symbols
const layer: LayerInstance | undefined = iApi.geo.layer.getLayer(
data['rvUid']
)!;
const oidPair = props.params.layerCols[layer.id].find(
(pair: AttributeMapPair) => pair.origAttr === layer.oidField
);
if (oidPair.mappedAttr) {
const oid = data[oidPair.mappedAttr];
layer.getGraphic(oid, {getAttribs: true}).then(g => {
iApi.event.emit(GlobalEvents.DETAILS_TOGGLE, {
data: g.attributes,
uid: props.params.data.rvUid,
format: IdentifyResultFormat.ESRI
});
});
}
It's a bit inefficient in that we are doing a local lookup for attributes when they likely exist in the row we're already on. But the result is a pristine attribute, the grid manipulations are avoided. This only happens on a user click so no big deal. Since grid is open, all attributes are already cached so just an object key lookup.
Anyway something to consider if un-mapping the grid stuff is difficult. Also, does our 'linkification' also change the attribute value in the grid? If so, there might be another lurking bug if we don't change the code to use getGraphic
. If details has a template, it will be getting data in one fromat from an identify and another from the grid.
To reproduce:
Merge Grid
.This grid has field mapping to align stuff. E.g. each layer has a unique field for the Symbol and Concentration, and the config contains a
fieldMap
to align those fields to a common field names (search forsources: ['NO2', 'Ozone', 'PM2_5']
in the code base to see the mapping).What I believe is happening is the data bundle being sent on the Details Open event is not reverse mapping the values. It has attributes named
Symbol
andConcentration
but the actual attribute names would be something likeNO2_Symbol
andNO2
.