Javascript API - Polygon : Very Urgent

1992
5
04-28-2014 02:34 AM
DiptiSheth
New Contributor
Hi,

Please find polygon code attached herewith.

It works only with hard-coded data and not with data passed through db.

Why so? Am I doing anything wrong or Is it a bug with ESRI map?

I searched/googled a lot, even posted on forums 3 times, but didn't get any satisfactory reply.

Please somebody look into this code and send me a sample of working code where data is passed through db, not hardcoded.

Thanks,
Dipti Sheth
0 Kudos
5 Replies
JeffPace
MVP Alum
If you have an urgent issue please call support
0 Kudos
JeffPace
MVP Alum
1. Define the polygon spatial reference before you add the ring
2. alert (thisLocs) right before you try to use it.  My guess is this is a scoping issue and it is null

try changing the line to

on(map, "load", lang.hitch(this, function(){addGraphic();}));
0 Kudos
DiptiSheth
New Contributor
1. Define the polygon spatial reference before you add the ring
2. alert (thisLocs) right before you try to use it.  My guess is this is a scoping issue and it is null

try changing the line to

on(map, "load", lang.hitch(this, function(){addGraphic();}));



Hi Jeff,

Many thanks to you for your reply.

I've tried both the things i.e.:
1. Defining spatial reference before adding ring
2. placing alert(thisLocs) before its use, gives its proper value. Its not null.

Secondly, I changed my code to

on(map, "load", lang.hitch(this, function(){addGraphic();}));


but, it doesn't call addGRaphic() function.

Thanks,
Dipti Sheth
0 Kudos
JeffPace
MVP Alum
this is just a guess but i am pretty confident it is your problem.

When you are hardcoding, you are sending an array.  When you pass as a variable, you are sending a string that Looks like an array (you replaced the )) with ]] ) but is not actually an array.

I think you need to actually build an array or convert your string to an array.

try calling dojo isArray on the variable. If it is false, that is your problem

http://dojotoolkit.org/reference-guide/1.7/dojo/isArray.html
0 Kudos
JeffPace
MVP Alum
any luck with your polygon?
0 Kudos