Class: FeatureList

ol.control. FeatureList

Feature list control


new FeatureList( [options] [, features])

Parameters:
Name Type Argument Default Description
options Object <optional>
Properties
Name Type Argument Default Description
title number <optional>

table title

target Element <optional>

to display the control outside the map

className string <optional>

use ol-bottom to scroll at bottom (default top)

collapsed boolean <optional>
true

collapse the list on start, default true

features Array.<ol.Feature> | ol.Collection.<ol.Feature> | ol.source.Vector <optional>

a set of feature to display. If provided as Source or Collection the features will stay in sync.

options.pageLength number <optional>
100

number of row to display in the table (page optimzation)

Fires:
  • event:select
  • event:dblclick
  • event:collapse
  • event:resize

Extends

Methods


_findRow(feature)

Find a row given a feature

Parameters:
Name Type Description
feature ol.Feature

addButton(options, className [, title] [, html], click)

Add a button to the list header menu

Parameters:
Name Type Argument Description
options Object
className string
title string <optional>
html string <optional>
click function

on click function

Returns:
Type
Element

collapse( [b])

Collapse the table

Parameters:
Name Type Argument Description
b boolean <optional>

if no parameters toggle it


enableSort(propName)

Enable sort list by properties in the header

Parameters:
Name Type Argument Description
propName string <repeatable>

formatProperty(feature,, prop)

Format feature property

Parameters:
Name Type Description
feature, ol.Feature
prop string

property name


getColumns( [features])

Get the list of columns

Parameters:
Name Type Argument Description
features Array.<ol.Feature> <optional>

a list of features to retrieve columns (if none, returns columns defined by setColumns)


getRowHeight()

Get height of a row

Returns:
Type
number

getSelection()

Get the current selection in the list

Returns:
Type
ol.Feature

getSort()

Get sorted properties list

Returns:

Object


isCollapsed()

Is the control collapsed


refresh( [force])

Refresh the list draw + resize use update if features have changed

Parameters:
Name Type Argument Description
force boolean <optional>

resetSort()

Reset all sorts


resize( [height])

Resize the control to the map

Parameters:
Name Type Argument Description
height number <optional>

the table height (if in a map sticks to the viewport height)


scrollTo(feature)

Scroll to an element / feature

Parameters:
Name Type Description
feature ol.Feature | string

a featue or select to scroll at the selected row


select( [feature] [, noScroll])

Select a feature in the list

Parameters:
Name Type Argument Default Description
feature ol.Feature <optional>

if none remove selection

noScroll boolean <optional>
false

prevent scrolling to the selected row


setBottomScroll(b)

Scroll resize at botton

Parameters:
Name Type Description
b boolean

setColumns(columns)

Set the list of columns to display

Parameters:
Name Type Description
columns Array.<string>

setFeatures(source)

Set the features to list

Parameters:
Name Type Description
source ol.source.Vector | ol.Collection.<ol.Feature> | Array.<ol.Feature>

a vector source or a collection of features to list


setMap(map)

Set the map instance the control is associated with and add its controls associated to this map.

Parameters:
Name Type Description
map ol.Map

The map instance.


sort()

Sort features in the table


sortBy(prop [, sort])

Sort list by properties

Parameters:
Name Type Argument Description
prop string

property name

sort string <optional>

'up' or 'down', default remove sort


sortFn(f1, f2, prop)

A sort function to compare 2 properties

Parameters:
Name Type Description
f1 ol.Feature
f2 ol.Feature
prop string

property name to sort at

Returns:

number -1: v1 < v2, 1: v1 > v2, 0: v1 = v2


update()

Update the list (when features have changed without dispatching event).


updateFeature(feature)

Update a feature line in the table (attribute changed)

Parameters:
Name Type Description
feature ol.Feature
Returns:
Type
boolean