Does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries.
1.) You can select features in a FeatureLayer that's using a FeatureCollection using an Extent geometry, objectIds or timeExtent.
2.) The AttributeInspector should work with a FeatureLayer that's using a FeatureCollection.
Dasa Paddock
Esri Flex Team
You could create a feature collection based feature layer and use that with the AttributeInspector widget.
.. Kelly Hutchins (ESRI)
//NEW code to test the creation of the FeatureCollection FeatureLayer //I have tried diferent variations of this code and have simplified it down to this var fieldsArray = [{ "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" }, { "name": "GAZ_ID", "type": "esriFieldTypeInteger", "alias": "GAZ_ID" }, { "name": "GAZ_FEATUREHISTORY", "type": "esriFieldTypeString", "alias": "GAZ_FEATUREHISTORY", "length": 1073741822 }, { "name": "GAZ_FEATUREDESCRIPTION", "type": "esriFieldTypeString", "alias": "GAZ_FEATUREDESCRIPTION", "length": 1073741822}]; var layerDefinition = { "type": "Table", "fields": fieldsArray }; var featureCollection = { "layerDefinition": layerDefinition, featureSet: null }; _customFeatureLayer = new esri.layers.FeatureLayer(featureCollection, { "id": "myCustomClass", outFields: ["GAZ_ID", "GAZ_FEATUREHISTORY", "GAZ_FEATUREDESCRIPTION"] }); _customFeatureLayer.setEditable(true); _map.addLayer(_customFeatureLayer); //create the layerInfo to add to the attribute inspector var layerInfos = [{ 'featureLayer': _customFeatureLayer, 'fieldInfos': fieldInfos, 'isEditable': isTableEditable, 'showDeleteButton': false}]; var relTableAttInspector = new esri.dijit.AttributeInspector( { 'layerInfos': layerInfos }, attributeDivId); //at some point in the app prior to showing the attribut UI I attempt to create a new record in the FeatureCollection layer based on an existing attribute record from the FeatureLayer/table _customFeatureLayer.applyEdits(results.selectionLayers[0].features, null, null, function (addResults) { if (addResults[0].success) { //var jsonObject = _customFeatureLayer.toJson(); //Now select the record so it shows up in the attribute UI var query = new esri.tasks.Query(); query.returnGeometry = false; query.objectIds = [addResults[0].objectId]; query.outFields = ["GAZ_ID", "GAZ_FEATUREHISTORY", "GAZ_FEATUREDESCRIPTION"]; _customFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (features) { helperOperations.hideProcessingDialog(); showAttributePane(); }, function (e) { processError("Error: " + e.message); }); } else { helperOperations.hideProcessingDialog(); showAttributePane(); } }, function (error) { processError("Error: unable to insert a record into the custom FeatureLayer"); });
Solved! Go to Solution.
So this thread is really old - but maybe you can still help me out? I am getting the same error you did at v3.22. I am creating a feature layer from a feature collection (so all the data is stored client side). My data is already spatial, and I define it as such when I instantiate the featurelayer ("esriGeometryPoint")., but I'm still getting the error. Would you happen to still have the code that you used to get this working? The only difference is that I am not needing to query on objectIds. I just want to query based on a mappoint and distance buffer, and no where statement.
thanks!
Also it seems that the queryObjectIDs is mandatory for it to work? This makes no sense to me. Basically I can grab single features from an on click event on the feature layer directly, however, what if <1 point are on top of each other? I want all the data. Hence, I was going to use the queryfeatures with a buffer with a map on click. I don't know what my objectids are, and I don't actually care. Any ideas?
Hi sorry for the late response, I only just now logged back in to my personal ESRI account and saw this thread. I no longer have access to the code since I do not work at that client - got a new gig. But if you want to share your code, I would be happy to look at it and see if I have any ideas on what might be going on.
Diana