FeatureTable syncSelection

5110
4
05-13-2016 11:50 AM
JillianStanford
Occasional Contributor III

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.

0 Kudos
4 Replies
JonathanUihlein
Esri Regular Contributor

Hi Jillian, thanks for reporting this issue. It should be fixed in the upcoming 3.17 release.

0 Kudos
JillianStanford
Occasional Contributor III

Hi Jonathan.

There will be a 3.17 release? In addition to 4.0?

Thanks for the reply!

Jill

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jillian,

Yes the 3.x and 4.x will continue to receive updates until the 4.x API is more mature and contains all the 3.x features that are not yet added to 4.0 based on the functionality matrix.

Functionality matrix | ArcGIS API for JavaScript 4.0

JillianStanford
Occasional Contributor III

Oh interesting. Thanks for the info, Robert!

0 Kudos