I'm trying to rewrite my esri-leaflet app to use the related tables plugin. (see attached)
I'm trying to query the table by clicking on a button (upper left above the map).
Joe,
I submitted an Issue to John on the problem I am seeing with the relationshipIds vs relationshipId. We will have to see what he says. It seems like an ArcGIS Server version compatability issue as relationshipIds works with ArcGIS Server 10.22 like his sample is using but does not work with 10.11 like you are using. You can use the workaround of changing the esri-leaflet-related.js as follows (line 7):
L.esri.Tasks.QueryRelated = L.esri.Tasks.Task.extend({ setters: { 'offset': 'offset', 'limit': 'limit', 'outFields': 'fields[]', 'objectIds': 'objectIds[]', 'relationshipId': 'relationshipId',
And then this code will work for you:
$('#NSM').click(function(evt){ $('#sidecol').empty(); buttonPicked = 'NSM'; buttonType = document.getElementById('NSM'); var query = L.esri.Tasks.query(tableURL).where("type like '" + buttonType.value + "'"); var rquery = L.esri.Tasks.queryRelated(tableURL).relationshipId("0"); query.ids(function(error, ids, response){ rquery.objectIds([ids.join(',')]); rquery.run(function(error, response, raw){ console.log(error); console.log(response); }); }); })
Robert,
It's a recently created esri-leaflet plugin
https://github.com/jgravois/esri-leaflet-related
Did you write the esri-leaflet-related.js? Because there is not a relationshipIds parameter on the related features query that takes an array it is relationshipId and take a single related id.
I've uploaded the esri related table library file
There are several *.js files missing from your zip file. It would a lot easier to help if all files where present.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.