Reusable Accessible Mapping Platform

API Docs for: 5.3.1
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.

Imports RAMP Modules:

RAMP
GraphicExtension
GlobalStorage
DatagridClickHandler
Map
EventManager
Theme
Util
Array
Dictionary
PopupManager
TmplHelper

Uses RAMP Templates:

templates/datagrid_template.json templates/extended_datagrid_template.json

Methods

activate

() private

Highlights the given graphic object using the specified cssClass.

adjustPanelWidth

()

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

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

(
  • 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

capturePanel

()

publishes the subPanel_Capture event to the GUI class

createDatatable

() private

Creates a Data table based on the grid configuration specified in the application config object. See http://datatables.net/reference/option/ 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

fetchRecords

(
  • visibleFeatures
)
private

Populate the datagrid with data in visibleFeatures

Parameters:

  • visibleFeatures Array

    a dictionary mapping layer id to an array of feature objects

generateToggleButtonDataForTemplate

() String private

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

Returns:

String:

the generated row data object.

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.

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.

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.

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

()

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

init

()

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

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

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

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

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.

setButtonEvents

() private

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

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

Properties

featureOidField

Unknown private

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

layerIdField

Unknown private

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

oTable

Unknown private

The jquery table

totalRecords

Unknown private

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

Events

Datagrid.APPLY_EXTENT_FILTER [subscribed]

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:669

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:678

Fires when the table has finished drawing

Datagrid.EXTENT_FILTER_END

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:685

Fires when the extent-filter has finished updating

Datagrid.HIGHLIGHTROW_HIDE

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:701

Dehighlights the currently highlighted row.

Datagrid.HIGHLIGHTROW_SHOW

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:692

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:716

Dehighlights the currently zoomlighted row.

Datagrid.ZOOMLIGHTROW_SHOW

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:707

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