|
POST
|
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:
... View more
12-21-2015
04:36 PM
|
0
|
2
|
1125
|
|
POST
|
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.
... View more
12-21-2015
03:14 PM
|
0
|
4
|
1125
|
|
POST
|
Ok. Here you go. The ultimate goal is to pass on the thislayer to the _openResultInAttributeTable so it can publish the table with the query results. As you can see from the line 276, the layer has the layer name, however the _openResultInAttributeTable cannot access it. The second issue is how to pass on the featureSet of the quesry results to the feature collection. When I including it it causes the Converting circular structure to JSON error. Thank you.
... View more
12-21-2015
11:01 AM
|
0
|
6
|
2823
|
|
POST
|
Ok. I didn't want to post a long script. I will create a smaller version of it and test it again. If still has problems, I will post it Thank you for your commitment helping others.
... View more
12-18-2015
10:03 AM
|
0
|
8
|
2823
|
|
POST
|
Sorry to drag it on, but it is confusing. Why do I need to assign a name to the layerinfo when it already has it? I verified it by using the code below. So by declaring layerDefinition: layerInfo, in the featurecollection the name should be passed on as well since I will use the same layerinfo for the new featurelayer as the myurl. However it is not passed on when a featurelayer is created using that feature collection. What am I missing here? Thank you for your patience. esriRequest({ url: myurl, content: { f: 'json' }, handleAs: 'json', callbackParamName: 'callback' }).then(lang.hitch(this, function (layerInfo) { console.log(layerInfo.name); //name is printed in console }
... View more
12-17-2015
09:19 PM
|
0
|
10
|
2823
|
|
POST
|
Thank you. It seems that the featureSet was causing the error. But how do I define the new layer based on the query selection. By defining the featureSet: null then the selection is null. Also, when I pass on thislayer to the _openResultInAttributeTable function, I get the error that it cannot read the 'name' of undefined even though the currentlayer is not null! _openResultInAttributeTable: function (currentLayer) { var aLayer = { layerObject: currentLayer, title: currentLayer.name, id: currentLayer.id, getLayerObject: function () { var def = new Deferred(); if (this.layerObject) { def.resolve(this.layerObject); } else { def.reject("layerObject is null"); ------------ ---------
... View more
12-17-2015
01:44 PM
|
0
|
12
|
2823
|
|
POST
|
I modified it but still get the same error. mapServiceUrl= <map service>; var requestHandle = esriRequest({ "url": dojo.replace("{0}/layers",[mapServiceUrl]), "content": { "f": "json" }, "callbackParamName": "callback" }); requestHandle.then(lang.hitch(this, function(response){ dojo.forEach(response.layers, function(layerInfo) { console.log(layerInfo); //checking layer name if(layerInfo.fields) { dojo.forEach(layerInfo.fields, function(fieldInfo) { console.log(fieldInfo); //checking fields }); } myfields =layerInfo.fields; }); })); var featureCollection = { "layerDefinition": null, "featureSet": { "features": [], "geometryType": "esriGeometryPoint" } }; layerDefinition = { "geometryType": "esriGeometryPoint", "objectIdField": "ObjectID", "field": [myfields] }; var featureCollection = { layerDefinition: layerDefinition, featureSet: featureSet }; var thislayer = new esri.layers.FeatureLayer(featureCollection); },
... View more
12-17-2015
12:15 PM
|
0
|
14
|
2823
|
|
POST
|
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"); },
... View more
12-15-2015
05:53 PM
|
0
|
15
|
7822
|
|
POST
|
oops. I was looking at the getOutputfileds function instead of the _getLayerInfoWithRelationships function.
... View more
12-15-2015
04:15 PM
|
0
|
0
|
605
|
|
POST
|
Yes, but the layerdefinition is esearch is derived from the configuration file. In my case, there is no config file. I'm trying to dynamically develop the layerdefintion from the json similar to the process posted at: Request layer info | ArcGIS API for JavaScript but so far I seem to be missing something...
... View more
12-15-2015
01:54 PM
|
0
|
2
|
605
|
|
POST
|
Hello. The link you provided in your last post is not working. Can you post your solution? Thanks.
... View more
12-15-2015
01:11 PM
|
0
|
0
|
864
|
|
POST
|
A question for featurecollection. If I want to use the layer definition of an existing feature layer that is on the map (same geometry, fields...) to define a new feature layer with a different featureSet, can I define the feature collection like: featureCollection = layerDefinition: <existing layer definition> featureSet: <new> ? Thank you.
... View more
12-14-2015
05:08 PM
|
0
|
4
|
3172
|
|
POST
|
Unfortunately, no. I tried in Chrome, IE and Firefox. Chorme and IE is completely blank. In firefox it just gives me the top and left menu but the content is blank as well.
... View more
12-14-2015
04:37 PM
|
0
|
7
|
3172
|
|
POST
|
Robert, I cannot access the fiddle you posted. It just gives me a blank screen in fiddle. Can you check or post the solution? Thanks.
... View more
12-14-2015
04:23 PM
|
0
|
9
|
3172
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 1 | 10-22-2025 03:33 PM | |
| 1 | 06-27-2025 11:29 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|