I get the Converting circular structure to JSON error when I create the feature layer, thislayer. Any ideas? Thank you..
var requestHandle = esriRequest({
"url": myurl, //I set the variable to a featureservice url
"content": {
"f": "json"
},
"callbackParamName": "callback"
});
myfields =requestHandle.then(this.requestSucceeded, this.requestFailed);
var layerDefinition = {
"geometryType": "esriGeometryPoint",
"fields": myfields,
"objectIdField": "OBJECTID",
}
var featureCollection = {
layerDefinition: layerDefinition,
featureSet: myfeatureSet //it's derived from a query
};
var thislayer = new esri.layers.FeatureLayer(featureCollection, {
id: "query layer",
mode: FeatureLayer.MODE_SNAPSHOT,
outFields:["*"]}
);
this._openResultInAttributeTable(thislayer);
},
requestSucceeded:function(response, io){
fields = array.map(response.fields);
return fields;
},
requestFailed: function(error, io){
console.log("got an error");
},
Solved! Go to Solution.
yes, i agree. Thank you for you kind words and your time. I have an observation. The selectInBuffer is called twice, creating two tabs on the Attribute table, one is with the field names and one one without it.
Thank you again.
Lefteris,
I have tested the exact code that I provided you several more times and it only opens one tab.
I just copied the code you gave me and I got this. This is bizarre. One of the screenshot (see below), shows the first tab with the field names and the second tab without the field names. So, I placed in the "theselectInBuffer" a console.log and it was called twice, and hence calling the attribute table twice.
selectInBuffer: function (results) {
array.map(results, lang.hitch(this, function(feature){
this.thelayer.add(feature);
}));
console.log("sign1");
this._openResultInAttributeTable(this.thelayer);
},
output:
Lefteris,
That is bizarre. I added a console.info to the selectInBuffer function as well and it is only called once. It must be in how you are using the widget in your app. Do you accidentally have it added twice in the config.json or something?
That was it. Thank you.