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
- activate
- AddStaticLayer
- adjustPanelWidth
- applyExtentFilter
- cacheSortedData
- capturePanel
- checkBoundary
- createDatatable
- createExtent
- createRowPrototype
- deactivate
- fetchRecords
- fullScreenCallback
- generateToggleButtonDataForTemplate
- getDataObject
- getFeatureLayer
- getGraphicFromButton
- getGraphicTitle
- getGridConfig
- getLayerConfig
- getNode
- getOid
- getTextContent
- getVisibleFeatureLayers
- handleGridEvent
- highlightrowHide
- highlightrowShow
- init
- init
- initListeners
- initScrollListeners
- initTooltips
- initUIListeners
- isFullScreen
- isReady
- navigateToRow
- newPopup
- onDetailDeselect
- onDetailSelect
- onZoomBack
- onZoomCancel
- onZoomTo
- refresh
- republish
- setBoundingBoxVisibility
- setButtonEvents
- toggleFullScreenMode
- tooltipster
- zoomlightrowHide
- zoomlightrowShow
Properties
Events
- advanced.ADVANCED_PANEL_CHANGED
- bookmark.GETLINK_PANEL_CHANGED
- datagrid.APPLY_EXTENT_FILTER [subscribed]
- datagrid.DRAW_COMPLETE
- datagrid.EXTENT_FILTER_END
- datagrid.HIGHLIGHTROW_HIDE
- datagrid.HIGHLIGHTROW_SHOW
- datagrid.ZOOMLIGHTROW_HIDE
- datagrid.ZOOMLIGHTROW_SHOW
- Navigation.FULL_EXTENT
- Navigation.PAN
- Navigation.ZOOM
- Navigation.ZOOM_STEP
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;
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.
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,featureId) => page where layerName and featureId are strings and page is a zero based int.
capturePanel
()
publishes the subPanel_Capture event to the GUI class
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.
createExtent
-
extentConfig
-
sr
Instantiates an extent from a JSON config object and spatial reference
Parameters:
-
extentConfig
Objectthe JSON config object
-
sr
Esri/SpatialReference
Returns:
An ESRI extent object based on the config data
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
fetchRecords
-
visibleFeatures
Populate the datagrid with data in visibleFeatures
Parameters:
-
visibleFeatures
Arraya dictionary mapping service url to an array of feature objects
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.
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
-
featureUrl
Return the feature layer corresponding to the given url.
Parameters:
-
featureUrl
Stringthe url 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:
getGridConfig
-
url
Returns the config Object for the given featureLayerUrl
Parameters:
-
url
String
Returns:
grid config
getLayerConfig
-
graphic
Given a graphic object, returns the config object associated with the graphic's layer.
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/layer/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
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
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
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
Properties
boundingBoxLayers
Array of esri/layer/GraphicsLayer
A list GraphicsLayer that represent the extent bounding box of the feature layers. {[esr/layer/featurelayers]} featureLayers A list of feature layers found in the application config {[esri/layer/graphiclayer]} An array of graphic layers to add to the map
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/layer/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
featureUrlField
Unknown
private
Name of the attribute used to store the feature url in the details and zoomTo buttons
fullExtent
Esri/geometry/Extent
private
Used for full extent in nav widget
getConfigUrl
Object
Returns a URL that points to the application configuration (JSON format) if it's hosted on a web service. This is not required if the application has a JSON config file in the website's folder
InitExtent
Esri/geometry/Extent
private
The initial extent of the map
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
advanced.ADVANCED_PANEL_CHANGED
Published whenever the user clicks on the get link button in the map toolbar.
bookmark.GETLINK_PANEL_CHANGED
Published whenever the user clicks on the get link button in the map toolbar.
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.