/ui/layers/listview

The module exports the default listview method.

Requires

  • module:/mapp/ui/layers/view

Methods

(inner) add(layer)

The add method creates a layer.view and adds this to the listview.

Parameters:
NameTypeDescription
layerlayer

The layer object to add

Properties
NameTypeAttributesDescription
layer.hiddenboolean<optional>

Do not create a layer.view and shortcircuit.

layer.groupstring<optional>

Create a layer group and or add the layer to an existing listview.group

Fires:
  • event:addLayerView

(inner) addLayer(layer)

Adds a layer to group [this].

Parameters:
NameTypeDescription
layerlayer

Layer to add to the group

(inner) chkVisibleLayer()

Checks if any layers in group are visible and toggles visibility button accordingly

(inner) createGroup(layer)

Parameters:
NameTypeDescription
layerlayer

The layer to add to a group.

Properties
NameTypeAttributesDescription
layer.groupstring

Group key.

layer.groupClassListstring<optional>

CSS classes to apply to group

layer.groupmetastring<optional>

HTML content for group metadata

(inner) listview(params)

Creates a listview for organizing and displaying map layers, optionally grouped.

A HTMLelement target property must be provided for the listview element to be rendered into.

An initial list of decorated mapview layers is optional since layers can be added to the listview object through the add method.

The listview method is a decorator which returns the decorated listview object.

mapp.ui.layers.listview({
  layers: mapview.layers,
  target: document.getElementById('layer-list')
});
Parameters:
NameTypeDescription
paramsObject

Configuration parameters

Properties
NameTypeAttributesDescription
params.targetHTMLElement

DOM element where the listview will be rendered

params.layersObject<optional>

Map of layer objects to be added to the listview