Hello,
Below code snippet is something that I use to set the QueryTask url propery.
I call this function at the map "onLoad" event.
Generally, this function works very well. And idea is that I would like to get the layer id by passing the layername.
Because, there's always a chance that I may alter the mxd by add, remove or change the order of layers.
Any way, this function seems to fail, as soon as I add a TiledMapServiceLayer. And I can not figure out why...
The TiledMapService gets be added to the map first before the DynamicMapService (MapLayer).
Anyone with this problem??
function Set_QueryTask_Layers() {
var items = dojo.map(MapLayer.layerInfos, function (info, index) {
if (info.name === 'LANDLEASE') {
llqueryTask = new esri.tasks.QueryTask(servicepath + "/" + info.id);
}
else if (info.name === 'County Zoning') {
zonequeryTask = new esri.tasks.QueryTask(servicepath + "/" + info.id);
}
else if (info.name === 'DOAPROPERTY') {
propqueryTask = new esri.tasks.QueryTask(servicepath + "/" + info.id);
}
return
});
}
thanks
Don Kang