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 conatiner.
Item Index
Methods
- activate
- activateRows
- adjustPanelWidth
- applyExtentFilter
- capturePanel
- createDatatable
- createRowPrototype
- deactivate
- featureSorter
- fetchRecords
- generateToggleButtonDataForTemplate
- getDataObject
- getGraphicFromButton
- getGraphicIndex
- getGraphicTitle
- getGridConfig
- getLayerConfig
- getNode
- getOid
- getTextContent
- handleGridEvent
- highlightrowHide
- highlightrowShow
- init
- initListeners
- initScrollListeners
- initTooltips
- initUIListeners
- isReady
- navigateToRow
- newPopup
- onDetailDeselect
- onDetailSelect
- onHide
- onZoomBack
- onZoomCancel
- onZoomTo
- setButtonEvents
- sortFcns
- update
- zoomlightrowHide
- zoomlightrowShow
Attributes
Events
- bookmark.events.GETLINKPANEL_CHANGED
- datagrid.events.APPLY_EXTENT_FILTER [subscribed]
- datagrid.events.DRAW_COMPLETE
- datagrid.events.EXTENT_FILTER_END
- datagrid.events.HIGHLIGHTROW_HIDE
- datagrid.events.HIGHLIGHTROW_SHOW
- datagrid.events.ZOOMLIGHTROW_HIDE
- datagrid.events.ZOOMLIGHTROW_SHOW
- Navigation.events.FULL_EXTENT
- Navigation.events.PAN
- Navigation.events.ZOOM
- Navigation.events.ZOOM_STEP
Methods
activate
()
private
Highlights the the given graphic object using the specified cssClass.
activateRows
()
Navigates the grid to a row. Based on the following precedent: 1. User selected point, 2. Highlighted row, 3. zoomed row, 4. first row in the grid.
adjustPanelWidth
()
Adjusts the width of the data grid panel to accommodate the scrollbar.
applyExtentFilter
()
Gets all layer data in the current map extent that are visible, and put the data into the data grid.
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://www.datatables.net/usage/columns for addition information on config parameters.
createRowPrototype
-
cssClass
Creates a data grid 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 data grid row
deactivate
()
private
Removes a specified cssClass from a given graphic object in the data grid
featureSorter
-
e1
-
e2
Sort by feature name, then by oid, then by feature url (alphabetically ascending)
Returns:
a positive integer if e1 is greater (in sort order) than e2, a negative integer if e2 is greater than e1, 0 if the two are considered equal by sort order
fetchRecords
-
visibleFeatures
Populate the data grid with data in visibleFeatures
Parameters:
-
visibleFeatures
Arraya dictionary mapping service url to an array of feature objects
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 data grid.
Parameters:
-
feature
Objectthe feature needs to be represented in the data grid return {Array} an array representing the data the given feature contains.
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.
getGraphicIndex
-
graphic
Returns the index of the given graphic object in the data grid
Parameters:
-
graphic
Object
getGraphicTitle
-
graphic
Parameters:
-
graphic
Objecta 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
Objecta 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.
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
handleGridEvent
-
e
-
fcn
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
-
fcn
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
()
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 filterManager/global-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 (!!2 handlers for this event!!) datagrid/zoomlightrow-show datagrid/zoomlightrow-hide
isReady
()
Boolean
Indicates that the Data grid is fully rendered
Returns:
A 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
onHide
()
private
Removes the animating CSS class to prevent flickering
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
Object
setButtonEvents
()
private
Adds event-handling for buttons inside the data grid's row elements (i.e 'Details', 'Zoom To' buttons)
sortFcns
-
e1
-
e2
Sorts by layer name then by feature (alphabetically ascending)
Returns:
A array of sorted objects
update
()
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.
zoomlightrowHide
()
private
De-activiates 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
Attributes
Events
bookmark.events.GETLINKPANEL_CHANGED
Published whenever the user clicks on the get link button in the map toolbar.
datagrid.events.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.events.DRAW_COMPLETE
Fires when the table has finished drawing
datagrid.events.EXTENT_FILTER_END
Fires when the extent-filter has finished updating
datagrid.events.HIGHLIGHTROW_HIDE
Dehighlights the currently highlighted row.
datagrid.events.HIGHLIGHTROW_SHOW
Highlights the row corresponding to the given graphic
object of the selected feature.
datagrid.events.ZOOMLIGHTROW_HIDE
Dehighlights the currently zoomlighted row.