'featureCollection' expects a 'features' attribute which is a FeatureSet, and not a featureSet attribute like you are doing:
var featureCollection = {
layerDefinition: {
"geometryType": "esriGeometryPolyline",
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID"
},
{
"name": "text",
"type": "esriFieldTypeString"
},
{
"name": "address",
"type": "esriFieldTypeString"
}
]
},
features:
[
{
"attributes": {
OBJECTID : 1,
text : 'a',
address : 'b',
},
"geometry": { "x": -80.12468662, "y": 40.42756484 }
}
]
};
For future debugging, I suggest copying the ESRI obfuscated code, and making it more readable by using JS Beautifier. Then just search for the error (in my case error was with variable _190). That should help you out with figuring out where and why the error occurs.
The best way to make this work is to update your geometry and then set the geometry for your graphic. After a graphic's setGeometry method is called, the graphic will update.
If everything worked as it should, you would call insertPoint on your polyline and then pass your polyline to your graphic's setGeometry method. That being said, your use case uncovered a bug in insertPoint. The current implementation(version 2.6 of the API) won't let you insert a point on the end of a path. The best workaround is to use addPath. The code would look like this:
// add a polyline, line and lineGraphic are global
var p1 = esri.geometry.geographicToWebMercator(new esri.geometry.Point(-100, 40, map.spatialReference));
var p2 = esri.geometry.geographicToWebMercator(new esri.geometry.Point(-90, 40, map.spatialReference));
line = new esri.geometry.Polyline();
line.addPath([p1, p2]);
lineGraphic = map.graphics.add(new esri.Graphic(
line,
new esri.symbol.SimpleLineSymbol()
));
dojo.connect(map, "onClick", addPt);
And the body of the addPt function:
line.addPath([
line.paths[pathCount-1][line.paths[pathCount-1].length-1],
[e.mapPoint.x, e.mapPoint.y]
]);
lineGraphic.setGeometry(line);
Here's a working example: http://jsfiddle.net/swingley/SntsN/ Click the map to extend the line. We will (hopefully) fix this bug in the next release of the API, which is 2.7.
Best Answer
Adapted from some code I have -- untested here -- the key is using the dojo DeferredList so that you know when all the queries to the seperate layers have returned.
When building the table I would reccomend the DataTables jquery based library -- works well for me, lots of features. http://www.datatables.net/