AnsweredAssumed Answered

FeatureTable syncSelection

Question asked by jestanford on May 13, 2016
Latest reply on May 17, 2016 by jestanford

Hi,

I've created a custom featureLayer from a featureClass that's been created from some query results. I add it to the map and then used it to spin up a featureTable. The featureTable looks fine but I can't seem to get table records to sync with the map graphics.

 

When I select a feature from the table, the header says that one feature has been selected but the map doesn't pan, like in the samples and I get the following console error:

 

TypeError: Object doesn't support property or method 'emit' TypeError: Object doesn't support property or method 'emit'

   at Anonymous function (http://js.arcgis.com/3.16/esri/dijit/FeatureTable.js:74:136)

 

If I choose "Center on Selection" from the Options menu I get an additional console error:

 

Error: FeatureLayer::_query - query contains one or more unsupported parameters

 

Can anyone point me to where I'm setting things up incorrectly?

 

var resultsLayerDefinition = {
    "geometryType": queryResults[0].geometryType,
    "fields": queryResults[0].fields
}; 
  
//Workaround. FeatureTable will not work with results directly.
//https://community.esri.com/thread/165943
var copyFeatures = dojo.map(allFeatures, function (feature) {
    return new Graphic(feature.toJson());
});

var resultsFeatureClass = {
    layerDefinition: resultsLayerDefinition,
    featureSet: {
         "features": copyFeatures,
         "geometryType": queryResults[0].geometryType
    }
};

this._resultsFeatureLayer = new FeatureLayer(resultsFeatureClass);

var renderer = new SimpleRenderer(this._pointSymbol);
this._resultsFeatureLayer.setRenderer(renderer);

this.map.addLayer(this._resultsFeatureLayer);

this._resultsAttributeTable = new FeatureTable({
    "featureLayer" : this._resultsFeatureLayer,
    "map" : this.map,
    "syncSelection": true,
    "zoomToSelection": true
}, 'attributeTable');

this._resultsAttributeTable.startup();

 

I'm using JSAPI 3.16.

 

Thanks!

Jill

 

ETA: It seems that others have reported this issue: JSAPI Feature layer created from feature collection and the feature table.

Outcomes