Code Monkey home page Code Monkey logo

phpmaps / arcgis-dijit-table-of-contents Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esri/arcgis-dijit-layer-list

0.0 1.0 0.0 409 KB

The TableOfContents widget provides a table of contents that allows the toggling of layer visibility and sublayers. The style can be completely changed and skinned to match your own map design.

Home Page: http://esri.github.io/arcgis-dijit-table-of-contents/

License: Apache License 2.0

CSS 46.52% JavaScript 53.48%

arcgis-dijit-table-of-contents's Introduction

TOC Widget

Features

The TableOfContents widget provides a table of contents that allows the toggling of layer visibility. The style can be completely changed and skinned to match your own map design.

This widget does not support toggling individual sublayers (i.e. visibleLayers of dynamic map service).

View it live

Quickstart

var map = response.map;
var layers = response.itemInfo.itemData.operationalLayers;

myWidget = new TableOfContents({
  map: map,
  layers: layers
}, "TableOfContents");
myWidget.startup();

New to Github? Get started here.

Setup

Set your dojo config to load the module.

var package_path = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
var dojoConfig = {
	// The locationPath logic below may look confusing but all its doing is
	// enabling us to load the api from a CDN and load local modules from the correct location.
	packages: [{
		name: "application",
		location: package_path + '/js'
	}]
};

Require module

Include the module for the TOC.

require(["application/TableOfContents", ... ], function(TableOfContents, ... ){ ... });

Constructor

TableOfContents(options, srcNode);

Options (Object)

property required type value description
theme string TableOfContents CSS Class for uniquely styling the widget.
map x Map null ArcGIS JS Map
layers x Array null Array of layers
visible Boolean true Show the widget

Layers Object

This is what the layers array should look like. It follows the response from a webmap's operational layers.

layers = [
	{
 	   layer: LayerObject
	    defaultSymbol: Symbol
	    title: String
	},
	{
		...
	}
];

Properties

property type description
theme string CSS Class for uniquely styling the widget.
map Map ArcGIS JS Map
layers Array Array of layers
visible Boolean Show the widget
loaded Boolean If the widget has been loaded.

Methods

startup

startup(): Start the widget.

destroy

destroy(): Destroy the widget.

show

show(): Show the widget.

hide

hide(): hide the widget.

refresh

refresh(): reload all layers and properties that may have changed.

Events

load

Example

on(widget, 'load', function(evt){…})

Event Object

{}

toggle

Example

on(widget, 'toggle', function(evt){…})

Event Object

{
	expand: <Boolean>,
    index: <integer>
}

Requirements

  • Notepad or HTML editor
  • A little background with Javascript
  • Experience with the ArcGIS Javascript API would help.

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Anyone and everyone is welcome to contribute.

Licensing

Copyright 2012 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

[](Esri Tags: ArcGIS JavaScript API Layer TOC Table of Contents Public) [](Esri Language: JavaScript)

arcgis-dijit-table-of-contents's People

Contributors

alaframboise avatar driskull avatar tomwayson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.