Reusable Accessible Mapping Platform

API Docs for: 5.0.0
Show:

Datagrid Class

The Datagrid class represents the side bar table shown next to the map. The data grid displays all map objects in a text format and allows the user to see more details (same as clicking the map object) and navigate to the object. This class create the UI panel, events, and event-handles for the data grid container.

Item Index

Methods

_hideLoadingImg

() private

Hides the loading image.

_initEventHandlers

(
  • map
)
private

Creates event handlers for the map control: click, mouse-over, load, extent change, and update events.

Parameters:

  • map Object

    A ESRI map object

_initListeners

(
  • map
)
private

Subscribe to external events (published using topic.publish) and react accordingly

Parameters:

_initRepublishers

(
  • map
)
private

Republishes map events to the outside using topic.publish

Parameters:

_initScale

(
  • event
)
private

Initialize Map Scale

Parameters:

_showLoadingImg

() private

Shows the loading image.

_toggleFullScreenMode

(
  • fullscreen
)

Toggles full screen mode

Parameters:

  • fullscreen Boolean

    true - full screen on; false - full screen off; undefined - toggle;

_updateScale

(
  • event
)
private

Update Map Scale when zoom level changes

Parameters:

_wrapFileCallInPromise

(
  • readMethod
)
Function private

Helper function for wrapping File API calls in Promise objects. Used for building a series of helpers which call different file read methods.

Parameters:

  • readMethod String

    a string indicating the FileReader method to call

Returns:

Function:

a function which accepts a {File} object and returns a Promise

activate

() private

Highlights the given graphic object using the specified cssClass.

AddStaticLayer

(
  • layer_type
  • layer_url
  • layer_op
)
private

Add a static, non-interactive Layer to the map

Parameters:

  • layer_type String

    A value which controls how the layer is going to be added to the map

  • layer_url String

    A URL pointing to a valid map service endpoint

  • layer_op Number

    A value between 0.0 and 1.0 which determines the transparency of the layer

adjustPanelWidth

()

Adjusts the width of the datagrid panel to accommodate the scrollbar.

applyExtentDefaulting

() private

Apply extent defaulting prior to URL overrides.

applyExtentFilter

(
  • d
)

Gets all layer data in the current map extent that are visible, and put the data into the data grid.

Parameters:

  • d A Deferred object

cacheSortedData

() private

Caches the sorted data from datatables for feature click events to consume. Builds featureToPage as a mapping of (layerName,layerId) => page where layerName and layerId are strings and page is a zero based int.

capturePanel

()

publishes the subPanel_Capture event to the GUI class

capturePanel

(
  • force
)
private

Captures a subpanel that was opened and docked by the datagrid module previously.

Parameters:

  • force Boolean

    if truthy - capture the panel even if the datagrid is not visible; use when switching to datagrid tab and the datagrid is not fully rendered yet by the browser

checkBoundary

(
  • e
  • maxExtent
)
Esri/geometry/Extent

Given an ESRI Extent Object, returns a new ESRI Extent Object that contains the extent adjusted according to this map's maximum extent

NOTE: this method is currently unused!

Parameters:

  • e Esri/geometry/Extent

    the extent Object

  • maxExtent Esri/geometry/Extent

    the maximum extent

Returns:

Esri/geometry/Extent:

An adjusted extent, if the target extent is outside the boundary

createDatatable

() private

Creates a Data table based on the grid configuration specified in the application config object. See http://www.datatables.net/usage/columns for addition information on config parameters.

createRowPrototype

(
  • cssClass
)
Object private

creates a datagrid row that has the following features: highlight for a give graphic un-highlight scroll to for a give graphic

Parameters:

  • cssClass String

    the style that highlights the row.

Returns:

Object:

an object containing features of a datagrid row

deactivate

() private

Removes a specified cssClass from a given graphic object in the data grid

enhanceFileFeatureLayer

(
  • featureLayer
  • opts
)

Provided by the DataLoader module.

Defined in src\js\RAMP\Modules\dataLoader.js:477

Will take a feature layer built from user supplied data, and apply extra user options (such as symbology, display field), and generate a config node for the layer. Accepts the following options:

  • renderer: a string identifying one of the properties in defaultRenders
  • color: color of the renderer
  • icon: icon to display in grid and maptips
  • nameField: descriptive name field for the layer
  • datasetName: description of the name field

Parameters:

  • featureLayer Object

    a feature layer object generated by makeGeoJsonLayer

  • opts Object

    An object for supplying additional parameters

enhanceLayer

(
  • layer
  • config
  • userLayer
)

Adds custom ramp properties to layer. Adds handlers to loading events.

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

fetchRecords

(
  • visibleFeatures
)
private

Populate the datagrid with data in visibleFeatures

Parameters:

  • visibleFeatures Array

    a dictionary mapping layer id to an array of feature objects

finishExtentProjection

(
  • projectedMaxExtent
)
private

process the projected maximum extent, then alert app to continue loading the map. used as an asynchronous gate for the projection.

Parameters:

  • projectedMaxExtent Array

    an array containing the maximum extent object in the map's projection

fullScreenCallback

(
  • event
  • func
)
Object chainable

Allows to set callbacks to the full screen transition.

Parameters:

  • event String

    Event name to set a callback on

  • func Function

    A callback function

Returns:

Object:

This

generateToggleButtonDataForTemplate

() String private

Generates a data grid row data with a checkbox to be used in template

Returns:

String:

the generated row data object.

getBoundingBoxMapping

() Object

Returns the mapping of feature layer ids to assocciated bounding box layers.

Returns:

Object:

A dictionary of String, Esri/layers/GraphicsLayer pairs.

getDataObject

(
  • feature
)
private

Given a map feature, return a data object used to represent the feature in the datagrid.

Parameters:

  • feature Object

    the feature needs to be represented in the datagrid return {Array} an array representing the data the given feature contains.

getFeatureLayer

(
  • featureId
)
Esri/layers/FeatureLayer private

Return the feature layer corresponding to the given id.

Parameters:

  • featureId String

    the id of the feature layer

Returns:

Esri/layers/FeatureLayer:

feature layer

getGraphicFromButton

(
  • buttonNode
)
Object private

Returns the graphic object of a feature layer which is contained in the given buttonNode.

Parameters:

  • buttonNode JObject

    the node containing the feature layer

Returns:

Object:

the graphic object of the feature layer.

getGraphicTitle

(
  • graphic
)

Returns the content of the name field of the provided graphic object

Parameters:

  • graphic Esri/Graphic

    a graphic object or a feature object

Returns:

getNode

() Node: jObject, page: number private

Finds a row node corresponding to the given graphic object.

Returns:

Node: jObject, page: number:

} A row node that displays graphic information. If none found, returns an object with empty jNode.

getOid

(
  • graphic
)

Returns the oid of the given graphic object

Parameters:

  • graphic Esri/Graphic

getTextContent

(
  • graphic
)
Object private

Get popup content for a graphic (i.e. a point) This logic is customized per project

Parameters:

Returns:

Object:

found graphic object

getVisibleFeatureLayers

() Array

Returns a list of feature layers that are currently visible on the map.

Returns:

Array:

an array of Esri/layers/FeatureLayer objects

handleGridEvent

(
  • e
  • callback
)
private

A handler that handlers the Enter key press and Click mouse event of the data grid. It is actually a binder that binds the key / mouse event to a handler specified. This is wired up to grid cells in the bootstrapper to achieve click/keypress functions

Parameters:

  • e Event

    the event object

  • callback Function

    the callback function

highlightrowHide

() private

Un-highlights the row that is currently highlighted

highlightrowShow

(
  • event
)
private

Highlights the row according to the graphic stored in the event. Sets the hightlightRow variable to the graphic object inside the sent event

Parameters:

  • event Object

    A thrown event that contains a graphic object inside the grid

init

()

Initialize the datagrid. must be called before any properties can be accessed.

init

()

The constructor method for the data grid. Adds the grid's panel to the UI, adds the data rows, and creates all event triggers

initListeners

() private

Binding event handling for events: filterManager/layer-visibility-toggled datagrid/applyExtentFilter

initScrollListeners

() private

Apply's or removes the scrollbar from the data grid based on the height of its container.

initTooltips

() private

Initialize tooltips for the data grid

initUIListeners

() private

Registers event handlers for following events:

datagrid/highlightrow-show datagrid/zoomlightrow-show datagrid/zoomlightrow-hide

isFullScreen

() Boolean

Returns a boolean indication whether the full screen mode is on.

Returns:

Boolean:

true / false

isReady

() Boolean

Indicates that the Data grid is fully rendered

Returns:

Boolean:

_isReady flag indicating the render status of the data grid

isVisible

() Boolean private

Checks if the datagrid currently visible, i.e., the data tab is selected on the side panel

Returns:

Boolean:

indicating if the datagrid is currently visible

localProjectExtent

(
  • extent
  • sr
)
Esri/Extent private

Inherited from Map but overwritten in src\js\RAMP\Modules\map.js:420

Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service

Parameters:

Returns:

Esri/Extent:

extent in the desired projection

makeFeatureLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/FeatureLayer

Create a new FeatureLayer object based on the config input

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/FeatureLayer:

feature layer object (unloaded)

makeGeoJsonLayer

(
  • geoJson
  • opts
)
FeatureLayer

Provided by the DataLoader module.

Defined in src\js\RAMP\Modules\dataLoader.js:405

Converts a GeoJSON object into a FeatureLayer. Expects GeoJSON to be formed as a FeatureCollection containing a uniform feature type (FeatureLayer type will be set according to the type of the first feature entry). Accepts the following options:

  • renderer: a string identifying one of the properties in defaultRenders
  • sourceProjection: a string matching a proj4.defs projection to be used for the source data (overrides geoJson.crs)
  • targetWkid: an integer for an ESRI wkid, defaults to map wkid if not specified
  • fields: an array of fields to be appended to the FeatureLayer layerDefinition (OBJECTID is set by default)

Parameters:

  • geoJson Object

    An object following the GeoJSON specification, should be a FeatureCollection with Features of only one type

  • opts Object

    An object for supplying additional parameters

Returns:

FeatureLayer:

An ESRI FeatureLayer

makeStaticLayer

(
  • layerConfig
  • userLayer
)
Object private

Return the static layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Object:

layer object of the appropriate type

makeWmsLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/WMSLayer

Return the feature layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/WMSLayer:

WMS layer

navigateToRow

() Boolean private

Navigate to the page the row is in and scroll to it. Returns true if the row exists in the datagrid, false otherwise.

Returns:

Boolean:

A value indicating is the navigation is successful

newPopup

(
  • popupAttr
)
private

Create a new PopupBase object from the settings provided.

Parameters:

Returns:

popup

onDetailDeselect

()

This function is called whenever the "Details" button is deselected (either by the user click on another "Details" button, clicking on another point, or by clicking on an already highlighted "Details" button).

onDetailSelect

(
  • buttonNode
  • selectedGraphic
)

This function is called whenever the "Details" button is clicked in the datagrid.

Parameters:

  • buttonNode JObject

    the "Details" button node

  • selectedGraphic Object

    {esri/Graphic} the graphic object associated with the entry in the datagrid

onZoomBack

()

This function is called whenever the user clicks on the "Zoom Back" button.

onZoomCancel

()

Publishes new events when zoomCancel event happens. Following events are published: highlighter/zoomlight-hide datagrid/zoomlightrow-hide

onZoomTo

(
  • currentExtent
  • zoomToGraphic
)

This function is called whenever the user clicks on the "Zoom To" button.

Parameters:

  • currentExtent Esri/geometry/Extent

    the current extent of the map

  • zoomToGraphic Object

    graphic object of the feature to zoom to

prepLayer

(
  • layer
  • config
  • userLayer
)
private

Sets up loading event handlers and initializes the .ramp object of a layer Circular reference errors prevent us from calling LayerLoader directly from this module

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

projectConfigExtents

()

initiate the projection of the config extents to basemap extents

projectExtent

(
  • extent
  • sr
  • callWhenDone
)
private

project an extent to a new spatial reference, if required when projection is finished, call another function and pass the result to it.

Parameters:

projectFullExtent

(
  • projectedDefaultExtent
)
private

process the projected default extent, begin projection of full extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedDefaultExtent Array

    an array containing the default extent object in the map's projection

projectMaxExtent

(
  • projectedFullExtent
)
private

process the projected full extent, begin projection of maximum extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedFullExtent Array

    an array containing the full extent object in the map's projection

refresh

() Node: jObject, page: number private

Finds a row node corresponding to the given graphic object.

Returns:

Node: jObject, page: number:

} A row node that displays graphic information. If none found, returns an object with empty jNode.

republish

(
  • name
)
private

Republish map events using topic.publish

Parameters:

setBoundingBoxVisibility

(
  • layerId
)
private

Sets the visibility of the bounding box that belongs to the layer with the given layerId. Note: the layerId needs to be the ID of the featurelayer, not the ID of the actual bounding box layer.

Parameters:

  • layerId String

    the id of the layer whose bounding box visibility should be set

setButtonEvents

() private

Adds event-handling for buttons inside the data grid's row elements (i.e 'Details', 'Zoom To' buttons)

toggleFullScreenMode

(
  • fullscreen
)
Object chainable

Toggles the FullScreen mode of the application

Parameters:

  • fullscreen Boolean

    true - expand; false - collapse; undefined - toggle;

Returns:

Object:

This

tooltipster

(
  • target
  • type
  • [action]
)
Object chainable

Tooltip setter helper method.

Parameters:

  • target Jquery

    A node to looked for tooltiped children on

  • type String

    Type of the tooltips to set

  • [action] String optional

    Action name: "update" will update all the tooltips on target with their respective title attributes; null will create new tooltips

Returns:

Object:

This

updateDatasetSelectorState

(
  • state
  • [loaded]
)

Updates the state of the dataset selector based on whether the dataset has been loaded and what dataset is currently selected.

Parameters:

  • state Boolean

    indicates if button is disabled or not; true - disabled;

  • [loaded] Boolean optional

    indicates if the selected dataset is already loaded; it's assumed to be loading otherwise

updateNotice

() private

Update the datagrid notice to show feedback to the user if any. Right now is used to display notifications about scale dependent layers that are off scale at the moment.

zoomlightrowHide

() private

De-activates the row stored in zoomlightRow

zoomlightrowShow

(
  • event
)
private

Stores the graphic in the given event in the variable zoomlightRow

Parameters:

  • event Object

    A thrown event that contains a graphic object inside the grid

zoomToLayerScale

(
  • layerId
)

For a specified layer, zooms to the closest level that has some visible data.

Parameters:

  • layerId String

    a layer id to zoom to.

Properties

baseLayer

Esri/layers/ArcGISTiledMapServiceLayer private

The basemap layer

boundingBoxMapping

Object private

Maps the id of a graphic layer to the GraphicsLayer Object that represents its extent bounding box. A dictionary of String, Esri/layers/GraphicsLayer pairs.

featureLayers

Array private

An Array of Esri/layers/FeatureLayer objects.

featureLayerStartIndex

Integer private

The map not only contains feature layers, but also other layers such as the basemap layer, highlight layer, bounding box layer, etc. This variable is used to store the starting index of the feature layers in the map.

featureOidField

Unknown private

Name of the attribute used to store the oid in the details and zoomTo buttons

featureTypeToRenderer

Object private

Provided by the DataLoader module.

Defined in src\js\RAMP\Modules\dataLoader.js:38

Maps GeoJSON geometry types to a set of default renders defined in GlobalStorage.DefaultRenders

fullExtent

Esri/geometry/Extent private

Used for full extent in nav widget

getMap

Object

Return the map control object

getMaxExtent

Object

The maximum extent of the map control is allowed to go to

InitExtent

Esri/geometry/Extent private

The initial extent of the map

layerIdField

Unknown private

Name of the attribute used to store the layer id in the details and zoomTo buttons

maxExtent

Esri/geometry/Extent private

The maximum extent of the map

oTable

Unknown private

The jquery table

totalRecords

Unknown private

Total number of features in all the visible layers on the map

url

String private

The URL of the first layer of the basemap that is on by default.

wmsLayers

Array private

An Array of Esri/layer/WMSLayer objects.

Events

Datagrid.APPLY_EXTENT_FILTER [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:650

Applies a spatial filter to the datagrid (i.e. only visible points in the current extent will be displayed in the datagrid)

Datagrid.DRAW_COMPLETE

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:659

Fires when the table has finished drawing

Datagrid.EXTENT_FILTER_END

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:666

Fires when the extent-filter has finished updating

Datagrid.HIGHLIGHTROW_HIDE

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:682

Dehighlights the currently highlighted row.

Datagrid.HIGHLIGHTROW_SHOW

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:673

Highlights the row corresponding to the given graphic object of the selected feature.

Event Payload:

  • event Object
    • graphic Object

      ESRI graphic object corresponding to the selected feature

Datagrid.ZOOMLIGHTROW_HIDE

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:697

Dehighlights the currently zoomlighted row.

Datagrid.ZOOMLIGHTROW_SHOW

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:688

Zoomlights the row corresponding to the given graphic object of the zoomed to feature.

Event Payload:

  • event Object
    • graphic Object

      ESRI graphic object corresponding to the zoomed to feature