|
POST
|
Thanks Robert. Due to this limitation, the way I am handling this is by creating two listitems, one with black font color and the other with yellow, then toggling their listMode and visibility states. Yellow font color looks really good on the aerials, but not on the beige background of basemaps. The yellow font is difficult to see. This is when I want to use the black font color. Using two different layer listitems (black font and yellow), and watchUtils, I toggle the two aerial layers so only one will be checked in my LayerList design. Then I iterate over the listitems and set their listMode and visibility based on the font I want to use. Black font color Yellow font color watchUtils.whenFalse(item.layer, "visible", function (newVal) { layerListFormat(item); }); watchUtils.whenTrue(item, "visible", function (newVal) { layerListFormat(item); }); // end watchUtils.whenTrue /* * Black font color when no aerials checked * Yellow font color when basemap is not an aerial * @param item LayerList Layeritem * @returns true */ function layerListFormat(item) { var latest = item.layer.parent.allLayers.filter(function (a) { try { return a.title === "Latest Aerial"; } catch (error) { console.error("latest: " + error); } }); var prior = item.layer.parent.allLayers.filter(function (a) { try { return a.title === "Prior Year Aerials"; } catch (error) { console.error("prior: " + error); } }); var maplayers = item.layer.parent.allLayers.filter(function (a) { try { return a.title === "Map Layers & Labels"; } catch (error) { console.error("maplayers: " + error); } }); if (maplayers.length > 0) { var black = maplayers.items[0].sublayers.items.filter(function (a) { try { return a.id === 36; } catch (error) { console.error("black: " + error); } }); var yellow = maplayers.items[0].sublayers.items.filter(function (a) { try { return a.id === 7; } catch (error) { console.error("yellow: " + error); } }); if ((latest && latest.length > 0) && (prior && prior.length > 0)) { if ((black && black.length > 0) && (yellow && yellow.length > 0)) { // debug // black[0].title = "black"; // yellow[0].title = "yellow"; // show black when both are unchecked black[0].visible = !latest.items[0].visible && !prior.items[0].visible; // show yellow when one is checked yellow[0].visible = latest.items[0].visible || prior.items[0].visible; // show black when checked black[0].listMode = black[0].visible ? "show" : "hide"; // show yellow when checked yellow[0].listMode = yellow[0].visible ? "show" : "hide"; } } } return true; }
... View more
05-28-2019
09:16 AM
|
0
|
0
|
1106
|
|
POST
|
I need to add the legend icon to appear within each listitem. I will add a button beside the layer to toggle open\close state of all the listitems. Web Layer Title [icon-button] <--- click button to open layer legend Public Schools Sales Web Layer Title [icon-button] <--- click button to close layer legend Public Schools Sales
... View more
05-23-2019
05:21 AM
|
0
|
0
|
1093
|
|
POST
|
How do I get to the appropriate legend icon data from within listItemCreatedFunction and add the icon graphic to a Layerlist item? I am adding a legend to a LayerList with the legend button to the right of the layer title, and the legend icon graphic below the layer title. added with the code here var featureLayer = map.layers.getItemAt(2); if (item.layer.type != "group") { // don't show legend twice item.panel = { content: "legend", layerInfos: [{ layer: featureLayer, title: "blah" }], open: false }; } // end type I want to change this so that the legend icons are added to the LayerList Listitems instead. (image is from a web app. builder. I am not using wab)
... View more
05-22-2019
02:32 PM
|
0
|
2
|
1200
|
|
POST
|
I want to change the text color of an Annotation Layer based on layer visibility. Annotation Text shown here in yellow. The yellow text does not change. I can change certain properties, like minScale, but I cannot add a labelingInfo class. some info about the layer Display Field: TEXTSTRING Type: Annotation Layer Has Labels: false Can Modify Layer: false Can Scale Symbols: true Type ID Field: AnnotationClassID Fields: OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID ) FEATUREID ( type: esriFieldTypeInteger , alias: FEATUREID ) ZORDER ( type: esriFieldTypeInteger , alias: ZORDER ) ANNOTATIONCLASSID ( type: esriFieldTypeInteger , alias: ANNOTATIONCLASSID ) ELEMENT ( type: esriFieldTypeBlob , alias: ELEMENT ) SYMBOLID ( type: esriFieldTypeInteger , alias: SYMBOLID ) STATUS ( type: esriFieldTypeSmallInteger , alias: STATUS , Coded Values: [0: Placed] , [1: Unplaced] ) TEXTSTRING ( type: esriFieldTypeString , alias: TEXTSTRING , length: 255 ) FONTNAME ( type: esriFieldTypeString , alias: FONTNAME , length: 255 ) FONTSIZE ( type: esriFieldTypeDouble , alias: FONTSIZE ) BOLD ( type: esriFieldTypeSmallInteger , alias: BOLD , Coded Values: [1: Yes] , [0: No] ) ITALIC ( type: esriFieldTypeSmallInteger , alias: ITALIC , Coded Values: [1: Yes] , [0: No] ) UNDERLINE ( type: esriFieldTypeSmallInteger , alias: UNDERLINE , Coded Values: [1: Yes] , [0: No] ) VERTICALALIGNMENT ( type: esriFieldTypeSmallInteger , alias: VERTICALALIGNMENT , Coded Values: [0: Top] , [1: Center] , [2: Baseline] , ...1 more... ) HORIZONTALALIGNMENT ( type: esriFieldTypeSmallInteger , alias: HORIZONTALALIGNMENT , Coded Values: [0: Left] , [1: Center] , [2: Right] , ...1 more... ) XOFFSET ( type: esriFieldTypeDouble , alias: XOFFSET ) YOFFSET ( type: esriFieldTypeDouble , alias: YOFFSET ) ANGLE ( type: esriFieldTypeDouble , alias: ANGLE ) FONTLEADING ( type: esriFieldTypeDouble , alias: FONTLEADING ) WORDSPACING ( type: esriFieldTypeDouble , alias: WORDSPACING ) CHARACTERWIDTH ( type: esriFieldTypeDouble , alias: CHARACTERWIDTH ) CHARACTERSPACING ( type: esriFieldTypeDouble , alias: CHARACTERSPACING ) FLIPANGLE ( type: esriFieldTypeDouble , alias: FLIPANGLE ) OVERRIDE ( type: esriFieldTypeInteger , alias: OVERRIDE ) SHAPE_AREA_1 ( type: esriFieldTypeDouble , alias: SHAPE_AREA_1 ) SHAPE_LEN_1 ( type: esriFieldTypeDouble , alias: SHAPE_LEN_1 ) SHAPE ( type: esriFieldTypeGeometry , alias: SHAPE ) SHAPE.AREA ( type: esriFieldTypeDouble , alias: SHAPE.AREA ) SHAPE.LEN ( type: esriFieldTypeDouble , alias: SHAPE.LEN ) Here is my map var mapLayerAndLabels = new MapImageLayer({ url: mapLayerAndLabelsUrl, legendEnabled: true, visible: true, title: "Map Layers & Labels" }); // end mapLayerAndLabels map.add(mapLayerAndLabels); Here is my basic labelClass that will be added on layer visibility const labelClass = { // autocasts as new LabelClass() symbol: { type: "text", // autocasts as new TextSymbol() color: "green" }, font: { // autocast as new Font() size: 20, family: "sans-serif", weight: "bold" } }; The target layer. labelingInfo is null watch event to add the labelClass watchUtils.whenFalse(item, "visible", function (newVal) { switch (item.title) { case "Latest Aerial": if (!item.visible) { if (item.layer.parent.allLayers && item.layer.parent.allLayers.length > 0) { item.layer.parent.allLayers.forEach(function (item) { if (item.title === "Map Layers & Labels") { if (item.sublayers && item.sublayers.length > 0) { item.sublayers.forEach(function (item) { if (item.title === "Parcel Dimensions") { item.minScale = 55555; // this changes item.labelingInfo = [labelClass]; // not working } }); } } }); } } } // end switch }); // end whenFalse
... View more
05-22-2019
09:30 AM
|
0
|
2
|
1622
|
|
POST
|
Perhaps Outline is what you're looking for? https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html Paste a mock up of what you want to achieve.
... View more
05-09-2019
02:06 PM
|
0
|
0
|
2176
|
|
POST
|
I am using Wordpress and not loading jquery on my own. Only Edge browser complains about multipleDefine and https://js.arcgis.com/4.11/dojo/jquery.js doesn not exist. 404 Not Found Code: NoSuchKey Message: The specified key does not exist. Key: br/js/4.11/dojo/jquery.js RequestId: 6F4FCBCE6ED615D7 HostId: K/COu9ahK7kyQ+jalZPmJTIMiOYTCYJhGz9YRi3k8f6Qc27asDFWsPwsm/JYTeLc4QXyIOrWdLI= An Error Occurred While Attempting to Retrieve a Custom Error Document Code: NoSuchKey Message: The specified key does not exist. Key: error.html What exactly is "multipleDefine" trouble Edge, and how do I fix it?
... View more
05-09-2019
01:14 PM
|
0
|
1
|
5606
|
|
POST
|
Got it. Thanks. I had tried that but my fullscreen.viewModel was out of scope because I was calling it inside a trigger-action that was inside an IdentifyTask. var viewTrigger = view.popup.on("trigger-action", function (event) { if (event.action.id === "goto-parcel") { if (fullscreen.viewModel.state === 'active') { fullscreen.viewModel.exit(); } var parid = view.popup.selectedFeature.attributes.PARID; switchOwner(parid); } }); // end trigger-action
... View more
05-02-2019
02:17 PM
|
0
|
1
|
1620
|
|
POST
|
If I'm adding the fullscreen widget and activate fullscreen by clicking the widget, how do I programmatically exit fullscreen? var fullscreen = new Fullscreen({ view: view, element: aerialViewMap });
... View more
05-02-2019
01:14 PM
|
0
|
3
|
1864
|
|
POST
|
I would like to detect whether full screen is active and disable a function action on my popup. Would there be a property for this in the view?
... View more
05-01-2019
02:58 PM
|
0
|
3
|
1997
|
|
POST
|
Thanks. I am guessing that this line needs to be hit after any work on layer list items. And since I am iterating the layer list to hide items in listItemCreatedFunction, I'm not sure where to place it. Here's a codepen of my dev. https://codepen.io/gregbolog/pen/vMbEMG
... View more
04-26-2019
06:50 AM
|
0
|
2
|
2288
|
|
POST
|
Thanks. I implemented this code to hide subitems. if (item.layer.allSublayers && item.layer.allSublayers.length > 0) { item.layer.allSublayers.forEach(function (item) { if (item.sublayers && item.sublayers.length > 0) { item.sublayers.forEach(function (item) { item.listMode = "hide"; }); } }); }
... View more
04-26-2019
05:22 AM
|
0
|
0
|
2356
|
|
POST
|
I have a LayerList with 3 ListItems. I want to order the ListItems differently than how they are added to the view. Ex. (my maps need to be added in this specific order so that layers can be toggled in the LayerList) var map = new Map({ basemap: "streets" }); // Item 0 var latestYearAerial = new MapImageLayer({ url: latestYearAerialUrl, title: "Latest Aerial", }); map.add(latestYearAerial); // Item 1 var priorYearAerials = new WMSLayer({ url: priorYearAerialsUrl, imageTransparency: true, imageMaxWidth: 256, imageMaxHeight: 256, legendEnabled: false, visible: false, title: "Prior Year Aerials", }); map.add(priorYearAerials); // Item 2 var mapLayerAndLabels = new MapImageLayer({ url: mapLayerAndLabelsUrl, title: "Map Layers & Labels", }); map.add(mapLayerAndLabels); I want to order my ListItems in the LayerList in this order Item 0 Item 1 Item 2 but the result of the ListItems are reversed Item 2 Item 1 Item 0
... View more
04-25-2019
08:23 AM
|
0
|
4
|
2462
|
|
POST
|
What is the purpose of the timer in your solution? Why not just check the newValue and expanded property? if (newValue === true) { if (layerListExpand.expanded) { layerListExpand.collapse(); } }
... View more
04-25-2019
05:48 AM
|
0
|
1
|
4398
|
|
POST
|
JS 4.11 I am looking for a way to loop through the layers before they get added to my LayerList object and hide some layers. I can use listItemCreatedFunction: function (event) { } to access the layers and sublayers, but setting layer items visible to false does not work. I tried using LayerListViewModel but I could not find documentation on the class, and it just blows up on function not found. const layerListViewModel = new LayerListViewModel()({ view: view }); layerListViewModel.listItemCreatedFunction = function (event) { } https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-LayerListViewModel.html
... View more
04-18-2019
04:00 PM
|
0
|
4
|
2699
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-30-2024 01:32 PM | |
| 1 | 03-18-2024 08:18 AM | |
| 1 | 01-08-2024 07:24 AM | |
| 3 | 12-30-2022 11:36 AM | |
| 1 | 03-13-2023 07:40 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-12-2025
08:55 AM
|