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).
Solved! Go to Solution.
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);
});
});
})
Joe,
There are several *.js files missing from your zip file. It would a lot easier to help if all files where present.
I've uploaded the esri related table library file
Joe,
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.
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);
});
});
})
Joe,
If you check back on the GitHub Site John has accepted the bug and fixed it as I already described.