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
- _initEventHandlers
- _initListeners
- _initRepublishers
- _initScale
- _showLoadingImg
- _toggleFullScreenMode
- _updateScale
- _wrapFileCallInPromise
- activate
- AddStaticLayer
- adjustPanelWidth
- applyExtentDefaulting
- applyExtentFilter
- cacheSortedData
- capturePanel
- capturePanel
- checkBoundary
- createDatatable
- createRowPrototype
- deactivate
- enhanceFileFeatureLayer
- enhanceLayer
- fetchRecords
- finishExtentProjection
- fullScreenCallback
- generateToggleButtonDataForTemplate
- getBoundingBoxMapping
- getDataObject
- getFeatureLayer
- getGraphicFromButton
- getGraphicTitle
- getNode
- getOid
- getTextContent
- getVisibleFeatureLayers
- handleGridEvent
- highlightrowHide
- highlightrowShow
- init
- init
- initListeners
- initScrollListeners
- initTooltips
- initUIListeners
- isFullScreen
- isReady
- isVisible
- localProjectExtent
- makeFeatureLayer
- makeGeoJsonLayer
- makeStaticLayer
- makeWmsLayer
- navigateToRow
- newPopup
- onDetailDeselect
- onDetailSelect
- onZoomBack
- onZoomCancel
- onZoomTo
- prepLayer
- projectConfigExtents
- projectExtent
- projectFullExtent
- projectMaxExtent
- refresh
- republish
- setBoundingBoxVisibility
- setButtonEvents
- toggleFullScreenMode
- tooltipster
- updateDatasetSelectorState
- updateNotice
- zoomlightrowHide
- zoomlightrowShow
- zoomToLayerScale
Properties
Methods
_hideLoadingImg
()
private
Hides the loading image.
_initEventHandlers
-
map
Creates event handlers for the map control: click, mouse-over, load, extent change, and update events.
Parameters:
-
map
ObjectA ESRI map object
_initListeners
-
map
Subscribe to external events (published using topic.publish) and react accordingly
Parameters:
-
map
Objectmap object
_initRepublishers
-
map
Republishes map events to the outside using topic.publish
Parameters:
-
map
Objectobject
_showLoadingImg
()
private
Shows the loading image.
_toggleFullScreenMode
-
fullscreen
Toggles full screen mode
Parameters:
-
fullscreen
Booleantrue - full screen on; false - full screen off; undefined - toggle;
_wrapFileCallInPromise
-
readMethod
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
Stringa string indicating the FileReader method to call
Returns:
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
Add a static, non-interactive Layer to the map
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
Captures a subpanel that was opened and docked by the datagrid module previously.
Parameters:
-
force
Booleanif 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
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/Extentthe extent Object
-
maxExtent
Esri/geometry/Extentthe maximum extent
Returns:
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
creates a datagrid row that has the following features: highlight for a give graphic un-highlight scroll to for a give graphic
Parameters:
-
cssClass
Stringthe style that highlights the row.
Returns:
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
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
enhanceLayer
-
layer
-
config
-
userLayer
Adds custom ramp properties to layer. Adds handlers to loading events.
fetchRecords
-
visibleFeatures
Populate the datagrid with data in visibleFeatures
Parameters:
-
visibleFeatures
Arraya dictionary mapping layer id to an array of feature objects
finishExtentProjection
-
projectedMaxExtent
process the projected maximum extent, then alert app to continue loading the map. used as an asynchronous gate for the projection.
Parameters:
-
projectedMaxExtent
Arrayan array containing the maximum extent object in the map's projection
fullScreenCallback
-
event
-
func
Allows to set callbacks to the full screen transition.
Returns:
This
generateToggleButtonDataForTemplate
()
String
private
Generates a data grid row data with a checkbox to be used in template
Returns:
the generated row data object.
getBoundingBoxMapping
()
Object
Returns the mapping of feature layer ids to assocciated bounding box layers.
Returns:
A dictionary of String, Esri/layers/GraphicsLayer pairs.
getDataObject
-
feature
Given a map feature, return a data object used to represent the feature in the datagrid.
Parameters:
-
feature
Objectthe feature needs to be represented in the datagrid return {Array} an array representing the data the given feature contains.
getFeatureLayer
-
featureId
Return the feature layer corresponding to the given id.
Parameters:
-
featureId
Stringthe id of the feature layer
Returns:
feature layer
getGraphicFromButton
-
buttonNode
Returns the graphic object of a feature layer which is contained in the given buttonNode.
Parameters:
-
buttonNode
JObjectthe node containing the feature layer
Returns:
the graphic object of the feature layer.
getGraphicTitle
-
graphic
Returns the content of the name field of the provided graphic object
Parameters:
-
graphic
Esri/Graphica graphic object or a feature object
Returns:
getNode
()
Node: jObject, page: number
private
Finds a row node corresponding to the given graphic object.
Returns:
} 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
Get popup content for a graphic (i.e. a point) This logic is customized per project
Parameters:
-
graphic
Object
Returns:
found graphic object
getVisibleFeatureLayers
()
Array
Returns a list of feature layers that are currently visible on the map.
Returns:
an array of Esri/layers/FeatureLayer objects
handleGridEvent
-
e
-
callback
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
Eventthe event object
-
callback
Functionthe callback function
highlightrowHide
()
private
Un-highlights the row that is currently highlighted
highlightrowShow
-
event
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
ObjectA 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:
true / false
isReady
()
Boolean
Indicates that the Data grid is fully rendered
Returns:
_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:
indicating if the datagrid is currently visible
localProjectExtent
-
extent
-
sr
Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service
Parameters:
-
extent
Esri/Extentextent to be projected
-
sr
Esri/SpatialReferenceEsri/SpatialReference to project to
Returns:
extent in the desired projection
makeFeatureLayer
-
layerConfig
-
userLayer
Create a new FeatureLayer object based on the config input
Parameters:
Returns:
feature layer object (unloaded)
makeGeoJsonLayer
-
geoJson
-
opts
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:
Returns:
An ESRI FeatureLayer
makeStaticLayer
-
layerConfig
-
userLayer
Return the static layer corresponding to the given url.
Parameters:
Returns:
layer object of the appropriate type
makeWmsLayer
-
layerConfig
-
userLayer
Return the feature layer corresponding to the given url.
Parameters:
Returns:
WMS layer
newPopup
-
popupAttr
Create a new PopupBase object from the settings provided.
Parameters:
-
popupAttr
PopupBaseSettingsPopup settings
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
JObjectthe "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/Extentthe current extent of the map
-
zoomToGraphic
Objectgraphic object of the feature to zoom to
prepLayer
-
layer
-
config
-
userLayer
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
projectConfigExtents
()
initiate the projection of the config extents to basemap extents
projectExtent
-
extent
-
sr
-
callWhenDone
project an extent to a new spatial reference, if required when projection is finished, call another function and pass the result to it.
Parameters:
-
extent
Objectan extent object from the configuration
-
sr
Esri/SpatialReferenceEsri/SpatialReference to project to
-
callWhenDone
Functionfunction to call when extent is projected. expects geometry parameter
projectFullExtent
-
projectedDefaultExtent
process the projected default extent, begin projection of full extent. used as an asynchronous gate for the projection.
Parameters:
-
projectedDefaultExtent
Arrayan array containing the default extent object in the map's projection
projectMaxExtent
-
projectedFullExtent
process the projected full extent, begin projection of maximum extent. used as an asynchronous gate for the projection.
Parameters:
-
projectedFullExtent
Arrayan 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:
} A row node that displays graphic information. If none found, returns an object with empty jNode.
setBoundingBoxVisibility
-
layerId
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
Stringthe 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
Toggles the FullScreen mode of the application
Parameters:
-
fullscreen
Booleantrue - expand; false - collapse; undefined - toggle;
Returns:
This
tooltipster
-
target
-
type
-
[action]
Tooltip setter helper method.
Parameters:
Returns:
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.
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
Stores the graphic in the given event in the variable zoomlightRow
Parameters:
-
event
ObjectA 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
Stringa layer id to zoom to.
Properties
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.
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
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
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
Events
Datagrid.APPLY_EXTENT_FILTER [subscribed]
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
Fires when the table has finished drawing
Datagrid.EXTENT_FILTER_END
Fires when the extent-filter has finished updating
Datagrid.HIGHLIGHTROW_HIDE
Dehighlights the currently highlighted row.
Datagrid.HIGHLIGHTROW_SHOW
Highlights the row corresponding to the given graphic
object of the selected feature.
Datagrid.ZOOMLIGHTROW_HIDE
Dehighlights the currently zoomlighted row.