wab javascript dev editon widget.js widjets web appbuilder cus web appbuilder fo arcgis
Hi,
I'm making a customized WebApp using ArcGIS WAB. Customization include making some widgets and some non esri webapps which will perform some specific task on features selected on webapp using Select Widget.
All i'm trying here is to get OIDs of the selected features using a customized widget or a JavaScript code so i can pass those OIDs to my non esri webapps to perform some functions on data.
Any sort of help is much appreciated, because i'm tired of searching for solution of this small task on internet and finding nothing at all.
Thank you.
Solved! Go to Solution.
I found multiple solution for this one.
1- You can get OID of features selected from Select widget by running this function.
var ids = [];
array.forEach(this.map.itemInfo.itemData.operationalLayers, function (layer) {
var featureLayer = layer.layerObject;
array.forEach(featureLayer.getSelectedFeatures(), function (feature) {
ids.push(feature.attributes[featureLayer.objectIdField]);
}
}, this);
}, this)
2- The other way is to use popup window but for this to work you have to configure you popup to show OID
array.forEach(this.map.graphics.graphics,function(graphic){
var result = graphic.getLayer();
var info = result._map.attribution.map.infoWindow.domNode.innerText.split('\n');
var count = info.length;
if (count > 1 ) {
var oid = info[2].split('\t')[1];
}
})
I found multiple solution for this one.
1- You can get OID of features selected from Select widget by running this function.
var ids = [];
array.forEach(this.map.itemInfo.itemData.operationalLayers, function (layer) {
var featureLayer = layer.layerObject;
array.forEach(featureLayer.getSelectedFeatures(), function (feature) {
ids.push(feature.attributes[featureLayer.objectIdField]);
}
}, this);
}, this)
2- The other way is to use popup window but for this to work you have to configure you popup to show OID
array.forEach(this.map.graphics.graphics,function(graphic){
var result = graphic.getLayer();
var info = result._map.attribution.map.infoWindow.domNode.innerText.split('\n');
var count = info.length;
if (count > 1 ) {
var oid = info[2].split('\t')[1];
}
})