I'm generating and adding graphics to a client-side feature layer, but, after the LayerView updates, I cannot query on all of its attributes--only on its OBJECTID. Why am I not getting any other attributes?
To the "Create a FeatureLayer with client-side graphics" example, I have added the following snippet in addToView(). (See Codepen.)
view.whenLayerView(layer).then(lyrView => {
lyrView.watch("updating", updating => {
if (!updating) {
console.error("Assert > 1 availableFields", lyrView.availableFields.length > 1);
lyrView.queryFeatures({outFields: ["OBJECTID","url"]}).then((graphics)=>{
console.error("Assert _any_ graphics have an 'OBJECTID' attribute", graphics.features.filter(f => {return f.attributes["OBJECTID"]}).length > 0);
console.error("Assert _any_ graphics have a 'url' attribute", graphics.features.filter(f => {return f.attributes["url"]}).length > 0);
})
}
});
});
The console output I receive follows:
Assert > 1 availableFields false
_Any_ graphics have an 'OBJECTID' attribute true
_Any_ graphics have a 'url' attribute false
I expected to see availableFields having a length of 2 and to find "url" attributes in the query results.