Select to view content in your preferred language

Cannot get the ID of a standalone table within DynamicMapService

586
0
03-21-2013 02:34 AM
MiriEshel
Esri Contributor
Hi,

I have a Map service with one geographic layer and one DataBase standalone table.
In REST, I see both layer and table.
In JavaScript API, Layerinfos returns only the Layer's ID, not the Table's ID (the length I get is 1 instead of 2).
Is there any other way to get the ID of the table ?

Enclosed with the code that I'm running:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples
      on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Create Map</title>
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">

    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
    <script>
      dojo.require("esri.map");

      var map;
   var dynamicMapServiceLayer

      function init() {
        map = new esri.Map("map", { sliderOrientation: "horizontal" });
  dojo.connect(map, "onLoad", initToolbar);

        //Takes a URL to a non cached map service.
        dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://usaid-2k8:6080/arcgis/rest/services/MiriTestTable/MapServer");


        map.addLayer(dynamicMapServiceLayer);
      }

      dojo.addOnLoad(init);

function initToolbar(map) {
alert(dynamicMapServiceLayer.layerInfos.length);
for (var i=0, il=dynamicMapServiceLayer.layerInfos.length; i<il; i++) {
    alert(dynamicMapServiceLayer.layerInfos.id);
    }

}


    </script>
  </head>
  <body class="claro">
    <div id="map" style="width:900px; height:600px; border:1px solid #000;"></div>
  </body>
</html>



Thanks a lot,
Miri
0 Kudos
0 Replies