In the CSV drag and drop example Drag and drop to display data | ArcGIS API for JavaScript there is code that checks to see if you are dropping either a MapServer or FeatureServer. It works for map services, but when I try a FeatureServer, setting a breakpoint within the handleDrop function's 'else if' statement, I never see it execute:
else if (url.match(/(Map|Feature)Server\/\d+\/?$/i)) {
// ArcGIS Server Map/Feature Service Layer?
handleFeatureLayer(url); //this never fires
}
I'm not all that familiar with the more shortcut method of Javascript, so I'm not sure how to interpret the if statement. Is this not supposed to work with FeatureServer and I'm just reading this wrong?
Solved! Go to Solution.
That's a Regular Expression with its own type of syntax. There are some interpreters out there to decipher what that expression means. For example, this one reports this:
Unfortunately, I don't know why it doesn't return true with a valid layer in a FeatureService
Edit...
I ran this with this FeatureService layer and it did hit that function, so that syntax is working properly. You have to make sure you specify the layer, not just the service.
That's a Regular Expression with its own type of syntax. There are some interpreters out there to decipher what that expression means. For example, this one reports this:
Unfortunately, I don't know why it doesn't return true with a valid layer in a FeatureService
Edit...
I ran this with this FeatureService layer and it did hit that function, so that syntax is working properly. You have to make sure you specify the layer, not just the service.