-1

I'm having the exact same issue as this question:

TitlePane not rendering - working with basemapGallery sample code

but the solution doesn't work for me.

my javascript:


@@import "../Content/DataTables-1.9.4/media/css/demo_table.css";

<!-- JavaScript -->
<script type="text/javascript" charset="utf-8" src="../Scripts/DataTables-1.9.4/media/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js"></script>

<script src="http://js.arcgis.com/3.9/"></script>
<script>var dojoConfig = { parseOnLoad: true };</script>

<script type="text/javascript">

    /**Initialization code**/

    //------------------------
    //DataTables
    //------------------------


    $(document).ready(function () {
        $('#filterTable').dataTable(
            {
                // "bProcessing": true,
                // "bServerSide": true
            });
    });

</script>




<script>


    @foreach (var service in Model.MapService)
    {
         @:var tmpLayerUrl = "@service.ServiceUrl";
         @:var queryTaskUrl = "@service.ClientServiceUrl";
         @:var xMin = "@service.MinX";
         @:var xMax = "@service.MaxX";
         @:var yMin = "@service.MinY";
         @:var yMax = "@service.MaxY";
                    }
    dojo.require("dojox.grid.DataGrid");
    dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("esri.tasks.find");
    dojo.require("dijit.layout.BorderContainer");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("esri.map");
    dojo.require("dijit.form.Button");
    dojo.require("esri.dijit.BasemapGallery");
    dojo.require("esri.arcgis.utils");

    require([
        "esri/map",
        "esri/InfoTemplate",
        "esri/layers/ArcGISDynamicMapServiceLayer",
        "esri/symbols/SimpleFillSymbol",
        "esri/symbols/SimpleLineSymbol",
        "esri/tasks/IdentifyTask",
        "esri/tasks/IdentifyParameters",
        "esri/dijit/Popup",
        "dojo/_base/array",
        "esri/Color",
        "dojo/dom-construct",
        "esri/dijit/BasemapGallery",
        "esri/arcgis/utils",
        "dojo/parser",
        "dijit/layout/BorderContainer",
        "dijit/layout/ContentPane",
        "dijit/TitlePane",
        "dojo/domReady!"
    ], function (
        Map, InfoTemplate, ArcGISDynamicMapServiceLayer, SimpleFillSymbol,
        SimpleLineSymbol, IdentifyTask, IdentifyParameters, Popup,
        arrayUtils, Color, domConstruct, BasemapGallery, arcgisUtils,
    parser
      ) {

        parser.parse();

        // global variables
        var identifyTask, identifyParams;

        //initialize map when DOM is ready
        initMap();

        function initMap() {

            var extentJson = { "xmin": parseFloat(xMin), "ymin": parseFloat(yMin), "xmax": parseFloat(xMax), "ymax": parseFloat(yMax), "spatialReference": { "wkid": 102100 } };


            map = new esri.Map("map", {
                basemap: "gray",
                extent: new esri.geometry.Extent(extentJson)
            });

            //add the basemap gallery, in this case we'll display maps from ArcGIS.com 

            var basemapGallery = new BasemapGallery({
                showArcGISBasemaps: true,
                map: map
            }, "basemapGallery");
            basemapGallery.startup();

            basemapGallery.on("error", function (msg) {
                console.log("basemap gallery error:  ", msg);
            });

            var popup = new Popup({
                fillSymbol: new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
                new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
                  new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.25]))
            }, domConstruct.create("div"));

            //create and add new layer
            dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer(tmpLayerUrl);
            map.addLayer(dynamicLayer);

            dojo.connect(map, "onClick", executeIdentifyTask);               

            setupIdentifyTask();
        }

        function setupIdentifyTask() {
            //create identify tasks and setup parameters
            identifyTask = new IdentifyTask(tmpLayerUrl);

            identifyParams = new IdentifyParameters();
            identifyParams.tolerance = 10;
            identifyParams.returnGeometry = true;
            identifyParams.layerIds = [0, 1, 2];
            identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
            identifyParams.width = map.width;
            identifyParams.height = map.height;
        }

        function executeIdentifyTask(event) {
            identifyParams.geometry = event.mapPoint;
            identifyParams.mapExtent = map.extent;

            var deferred = identifyTask.execute(identifyParams).addCallback(function (response) {
                // response is an array of identify result objects
                // Let's return an array of features.
                return arrayUtils.map(response, function (result) {
                    var feature = result.feature;
                    var layerName = result.layerName;

                    feature.attributes.layerName = layerName;

                    infoTemplate = new InfoTemplate("</b>${ProjectName}", "<b>Location:</b> ${Location} <br/><br/> <b>Project Number:</b> ${ProjectNumber}");
                    feature.setInfoTemplate(infoTemplate);

                    return feature;
                });
            });
            // InfoWindow expects an array of features from each deferred
            // object that you pass. If the response from the task execution
            // above is not an array of features, then you need to add a callback
            // like the one above to post-process the response and return an
            // array of features.
            map.infoWindow.setFeatures([deferred]);
            map.infoWindow.show(event.mapPoint);
        }

    });

    var findTask, findParams;
    dojo.ready(setupFindTask);

    function execute(searchText) {
        //set the search text to find parameters
        findParams.searchText = searchText;
        findTask.execute(findParams, showResults);
    }

    function setupFindTask() {

        //create find task with url to map service
        findTask = new esri.tasks.FindTask(tmpLayerUrl);

        //create find parameters and define known values
        findParams = new esri.tasks.FindParameters();
        findParams.returnGeometry = true;
        findParams.layerIds = [0, 1, 2];
        findParams.searchFields = ["PROJECTNAME", "PROJECTNUMBER", "LOCATION", "AGENCY"];
    }

    function showResults(results) {
        //symbology for graphics
        var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
        var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1);
        var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));

        //find results return an array of findResult.
        map.graphics.clear();
        var dataForGrid = [];
        //Build an array of attribute information and add each found graphic to the map
        dojo.forEach(results, function (result) {
            var graphic = result.feature;
            dataForGrid.push([result.layerName, result.foundFieldName, result.value]);
            switch (graphic.geometry.type) {
                case "point":
                    graphic.setSymbol(markerSymbol);
                    break;
                case "polyline":
                    graphic.setSymbol(lineSymbol);
                    break;
                case "polygon":
                    graphic.setSymbol(polygonSymbol);
                    break;
            }
            map.graphics.add(graphic);
        });
        var data = {
            items: dataForGrid
        };
        var store = new dojo.data.ItemFileReadStore({
            data: data
        });

    }
</script>

my html which is below the javascript:

<body class="claro">

<section class="main-search">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <h2>View TIP Data</h2>
            <p>Edit existing TIP Data created through the system. Search and filter through preselected categories.</p>

            <!--//ToDo: Search box replaced by AJAX search in Datatables-->
            @using (Html.BeginForm())
            {

                <div class="form-group">
                    <div class="row">
                        <div class="col-xs-8">
                            Search Database: @Html.TextBox("SearchString")

                            <!--Search Filter Multiselect-->
                            <h5>Project Search</h5>
                            <div>
                                <h6>Search by Agency</h6>
                                @Html.ListBoxFor(x => x.SelectedAgencyIds, new SelectList(Model.Agencies, "Id", "Name"))
                            </div>
                            <div>
                                <h6>Search by Project Category</h6>
                                @Html.ListBoxFor(x => x.SelectedCategoriesIds, new SelectList(Model.Categories, "Id", "Name"), new { id = "projCategoryListBox" })
                            </div>
                            <div>
                                <h6>Search by Project Type</h6>
                                @Html.ListBoxFor(x => x.SelectedProjectTypesIds, new SelectList(Model.ProjectTypes, "Id", "Description"))
                            </div>
                            <h5>Funding Search</h5>
                            <div>
                                <h6>Search by Fiscal Year</h6>
                                @Html.ListBoxFor(x => x.SelectedFiscalYearIds, new SelectList(Model.FiscalYear))
                            </div>
                            <div>
                                <h6>Search by Phase</h6>
                                @Html.ListBoxFor(x => x.SelectedPhasesIds, new SelectList(Model.Phases, "Id", "Name"))
                            </div>
                            <div>
                                <h6>Search by Funding Source</h6>
                                @Html.ListBoxFor(x => x.SelectedFundingSourcesIds, new SelectList(Model.FundingSources, "Id", "Name"))
                            </div>
                            <div>
                                <h6>Search by Funding Type</h6>
                                @Html.ListBoxFor(x => x.SelectedFundingTypesIds, new SelectList(Model.FundingTypes, "Id", "Name"))
                            </div>
                        </div>
                        <div class="col-xs-2">
                            <input class="btn btn-success btn-lg" type="submit" value="Find" autocomplete="on" />
                        </div>
                    </div>
                </div>
            }

        </div>
    </div>

    <div id="GeographicalSearch" style="width:200px; height:75px;">
        Geographical Search
        @using (Html.BeginForm())
        {
            @Html.DropDownListFor(y => y.SelectedLayerName, new SelectList(Model.LayerItem))
            <br />
            @Html.DropDownListFor(y => y.SelectedFieldValue, new SelectList(Model.FundingSources, "Id", "Name"))
            <input type="submit" value="search" />
        }
        <div id="PoliticalSearch" style="width:200px; height:75px;">
            Political Boundary Search
            @using (Html.BeginForm())
            {
                @Html.DropDownListFor(y => y.SelectedLayerName, new SelectList(Model.FundingSources, "Id", "Name"))
                <br />
                @Html.DropDownListFor(y => y.SelectedFieldValue, new SelectList(Model.FundingSources, "Id", "Name"))
                <input type="submit" value="search" />
            }

        </div>


</section>
<section>
    <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <!-- label for="search-map">Search Map</label>-->
                <div class="row">
                    <div class="col-xs-8">
                        <input name="search-map" class="form-control" placeholder="Search map" type="text" id="searchText" />
                    </div>
                    <div class="col-xs-2">
                        <!-- <input type="button" value="Find" onClick="execute(dojo.byId('searchText').value);" />-->
                        <input type="button" class="btn btn-default" value="Find" onclick="execute(dojo.byId('searchText').value);" />
                    </div>
                </div>
            </div>
            <ol>
                @foreach (var service in Model.MapService)
                {
                 <!--Map Variables-->
                    var primaryService = service;
                    var idFindTaskUrl = primaryService.ServiceUrl;
                    var idFindTaskLayers = primaryService.ProjectLayerIdList;
                    var idFindTaskSearchFields = primaryService.ProjectSearchFieldList.Select(field => '"' + field.ToLower() + '"');

                }
            </ol>
        </div>
        <!--Map Search-->
    </div>
    <div class="col-md-8">

        <div data-dojo-type="dijit/layout/BorderContainer"
             data-dojo-props="design:'headline', gutters:false"
             style="width:100%;height:100%;margin:0;">

            <div id="map"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="region:'center'"
                 style="padding:0;">

                <div style="position:absolute; right:20px; top:10px; z-Index:999;">
                    <div data-dojo-type="dijit/TitlePane"
                         data-dojo-props="title:'Switch Basemap', closable:false,  open:false">
                        <div data-dojo-type="dijit/layout/ContentPane" style="width:380px; height:280px; overflow:auto;">
                            <div id="basemapGallery"></div>
                        </div>
                    </div>
                </div>

            </div>
        </div>

        <!--Only Administration Can create-->
        @if (User.Identity.IsAuthenticated)
        {
            if (User.IsInRole("Admin"))
            {
                <div>
                    @Html.ActionLink("Create", "Create")
                </div>
            }
        }
</section>

<section>
    <!--Filter Results Table-->
    <div class="row">
        <h2>Filter Results</h2>
        <table id="filterTable" class="datatable table table-condensed table-hover table-striped">
            <thead>
                <tr>
                    <th>Project Number</th>
                    <th>TIP #</th>
                    <th>Name</th>
                    <th>Agency</th>
                    <th>Section</th>
                    <th>Details</th>
                    @if (User.Identity.IsAuthenticated)
                    {
                        <th>Admin</th>
                    }
                </tr>
            </thead>
            <tbody>
                @if (Model.Project != null)
                {
                    foreach (var item in Model.Project)
                    {
                        <tr>
                            <td>
                                @Html.DisplayFor(modelItem => item.ProjectNumber)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.TIPNumber)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.ProjectName)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LookupAgency.Name)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.LookupSection.Name)
                            </td>
                            <td>
                                <label>@Html.ActionLink("Report", "MakePDF", "DetailedReport", new { id = item.Id }, new { target = "_blank" })</label>
                            </td>
                            <!--Only Administration Can edit-->
                            @if (User.Identity.IsAuthenticated)
                            {
                                <td>@Html.ActionLink("Edit", "Edit", new { id = item.Id }) @Html.ActionLink("Delete", "Delete", new { id = item.Id })</td>
                            }
                        </tr>
                    }
                }
            </tbody>
        </table>
    </div>
</section>

EDIT:

I copied your code from the new JSBin, and still it won't show the map, unless I comment out the parser.parse(); and if I do comment it out, the map shows but no TitlePane...

here is what I get back in the javascript console:

Attr.specified is deprecated. Its value is always true. init.js:149
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/info?f=json". init.js:159
Resource interpreted as Script but transferred with MIME type text/plain: "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gr…apServer?f=json&callback=dojo.io.script.jsonp_dojoIoScript1._jsonpCallback". init.js:505
Resource interpreted as Script but transferred with MIME type text/plain: "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gr…apServer?f=json&callback=dojo.io.script.jsonp_dojoIoScript2._jsonpCallback". init.js:505
XHR finished loading: GET "http://www.arcgis.com/sharing/rest/accounts/self?f=json&culture=en-us". init.js:159
XHR finished loading: GET "http://agsprod.dtsgis.com/arcgis/rest/info?f=json". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/16/32760/32760/8/8". init.js:159
XHR finished loading: GET "http://www.arcgis.com/sharing/rest/community/groups?q=title%3A%22ArcGIS%20Online%20Basemaps%22%20AND%20owner%3Aesri_en&f=json". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/16/32768/32760/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/16/32760/32768/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/16/32768/32768/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/16/32760/32760/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/16/32768/32760/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/16/32760/32768/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/16/32768/32768/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/15/16376/16376/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/15/16384/16376/8/8". init.js:159
XHR finished loading: GET "http://www.arcgis.com/sharing/rest/search?q=group%3A1f3bd43413f14b219643db9…20AND%20type%3A%22web%20map%22&sortField=name&sortOrder=desc&num=50&f=json". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/15/16376/16384/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/15/16384/16384/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/15/16376/16376/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/15/16384/16376/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/15/16376/16384/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/15/16384/16384/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/14/8184/8184/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/14/8192/8184/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/14/8184/8192/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/14/8192/8192/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/14/8184/8184/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/14/8192/8184/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/14/8184/8192/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/14/8192/8192/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/13/4088/4088/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/13/4096/4088/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/13/4088/4096/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/13/4096/4096/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/13/4088/4088/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/13/4096/4088/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/13/4088/4096/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/13/4096/4096/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tilemap/12/2048/2040/8/8". init.js:159
XHR finished loading: GET "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tilemap/12/2048/2040/8/8". init.js:159
3
  • Please explain how the answer doesn't work for you, and what you have tried.
    – Brad Nesom
    Commented May 8, 2014 at 19:41
  • The answer was: "Figured it out! The problem was in the HTML - I was referencing the the API and the JS file that contained all my JS before the dojoConfig object was defined. One I moved those references below the dojoConfig object (and removed async: true from its properties), the TitlePane worked just fine. So always make sure those script tags referencing the API and any separate JS file are placed after the script tag containing dojoConfig." So my understanding is that he is saying this line: <script>var dojoConfig = { parseOnLoad: true };</script> should be above these lines:
    – noobieDev
    Commented May 9, 2014 at 11:12
  • all the other javascript code and the html code referencing it. I've tried moving things all over the place but it would either break everything or still have the same problem. So right now, its in the order that I listed above.
    – noobieDev
    Commented May 9, 2014 at 11:14

1 Answer 1

1

so, here is a working version of your code: click for JSbin link

the changes i made to get it working -

  • added the missing closing tag on the last line '});'
  • removed comment from parser.parse() - this function call is needed as it is what creates the dojo dijits (widgets like the basemapgallery)
  • added the references to the esri css files - without this the basemapgallery works, but appears without the necessary styles
  • commented out your extent definition, and your map.click line as they reference functions and variables not provided (you should be able to re-enable them)
  • added the class 'claro' to the body tag, again, this is just so the basemapgallery has the correct style applied to it
  • i removed the top 2 lines in this block due to duplicate script opening tags, and html inside javascript

        <script type="text/javascript">  //if you open a script tag
       /*  <!--Maps-->  you would need to use a javascript comment not html comment*/
        <script> //this line is the same as <script type="text/javascript"> 
    

Update since you added new code above:

i get the impression your variables are not being placed into the JS correctly, when i replace the code below with specific values, it works fine.

try this: New JSbin

i made the following changes to your code, updated the jquery library to a public one, added links to the css files and the basemapgallery is now working as expected.

/*
@foreach (var service in Model.MapService)
{
     @:var tmpLayerUrl = "@service.ServiceUrl";
     @:var queryTaskUrl = "@service.ClientServiceUrl";
     @:var xMin = "@service.MinX";
     @:var xMax = "@service.MaxX";
     @:var yMin = "@service.MinY";
     @:var yMax = "@service.MaxY";
                }           

                */
//to this               
   var tmpLayerUrl = "test service url";
   var queryTaskUrl = "@service.ClientServiceUrl";
   var xMin = -122.68;
   var xMax = 45.53;
   var yMin = -122.45;
   var yMax = 45.6;
8
  • Thanks for your help. Sorry I didn't clean it up by commenting out things that weren't needed. So, the reason I commented out parser.parse() is that if I don't, the map won't show up at all, and there isn't a javascript error. If I comment it out, the map shows up, but not the TitlePane in the basemap switcher.
    – noobieDev
    Commented May 9, 2014 at 13:51
  • @user3461011 no problem! but did the pointers above and the code in the jsbin link solve your issue? :-) if not can you please give me some more details?
    – weaverk
    Commented May 9, 2014 at 14:02
  • oh, well no the problem is not solved. If I comment out parser.parse(); the map shows up, but the basemap switcher is open all the time, I can't close it. If I uncomment parser.parse(); the map doesn't show at all.
    – noobieDev
    Commented May 9, 2014 at 14:06
  • the jsbin based on the code you provided is working(shows the map, has the basemapgallery, can toggle it on and off), so i assume when you say its still not working you mean within your full application, if so, it sounds like there are other issues in the code not posted above unfortunately...
    – weaverk
    Commented May 9, 2014 at 14:27
  • I tried putting all my code in the JS Bin thing, and it works, but it doesn't work in my application, its that parser.parse(); line that doesn't work in my app that I guess is needed for the TitlePane. Do you have any suggestions? Its taking a long time for me to figure out what seems like a simple thing. I'll post all my code above in an edit
    – noobieDev
    Commented May 9, 2014 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.