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
Item Index
Methods
- activate
- adjustPanelWidth
- applyExtentFilter
- capturePanel
- capturePanel
- createDatatable
- createRowPrototype
- deactivate
- fetchRecords
- getDataObject
- getFDataFromButton
- getGraphicFromFData
- getNode
- handleGridEvent
- highlightrowHide
- highlightrowShow
- indexSortedData
- init
- init
- initListeners
- initScrollListeners
- initTooltips
- initUIListeners
- isReady
- isVisible
- navigateToRow
- refresh
- rowRenderer
- setButtonEvents
- updateDatasetSelectorState
- updateNotice
- zoomlightrowHide
- zoomlightrowShow
Properties
Methods
activate
()
private
Highlights this row using the specified cssClass.
adjustPanelWidth
()
Adjusts the width of the datagrid panel to accommodate the scrollbar.
applyExtentFilter
-
d
Rounds up all visible features in the current map extent, then triggers the process to add those features to the datagrid
Parameters:
-
d
Deferreda deferred to resolve after the grid has been populated
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
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
creates a datagrid row that has the following features: highlight for a given feature un-highlight scroll to for a given feature
Parameters:
-
cssClass
Stringthe style that highlights the row.
Returns:
an object containing features of a datagrid row
deactivate
()
private
Removes a specified cssClass from this row in the data grid
fetchRecords
-
visibleFeatures
Populate the datagrid with data belonging to features contained in visibleFeatures
Parameters:
-
visibleFeatures
Arraya dictionary mapping layer id to an array of on-map feature objects
getDataObject
-
fData
Given a feature data object, return a data object used to represent the feature in the datagrid. The data object is an ordered array of raw values
Parameters:
-
fData
Objectdata the feature needs to be represented in the datagrid return {Array} an array representing the data the given feature contains.
getFDataFromButton
-
buttonNode
Returns the feature data object which is encoded in the given buttonNode.
Parameters:
-
buttonNode
JObjectthe node containing the button
Returns:
the feature data object
getGraphicFromFData
-
fData
Returns the graphic object of a feature layer for the corresponding feature data object.
Parameters:
-
fData
Objecta feature data object
Returns:
the graphic object of the feature layer.
getNode
()
Node: jObject, page: number
private
Finds a row node corresponding to this object.
Returns:
} A row node that displays graphic information. If none found, returns an object with empty jNode.
handleGridEvent
-
e
-
callback
Handles 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
indexSortedData
()
private
Caches the sorted data from datatables for feature click events to consume. Builds featureToIndex as a mapping of (layerId,featureId) => row index in the table.
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:
_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
refresh
()
Node: jObject, page: number
private
Refresh the page index of this row
Returns:
} A row node that displays graphic information. If none found, returns an object with empty jNode.
rowRenderer
-
data
-
type
-
row
-
meta
Generates the content for a grid cell. Will use template engine the first time, cached value after that. Function must conform to datatables renderer api https://datatables.net/reference/option/columns.render
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.
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
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]
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.UPDATING
Is fired by the state manager when datagrid is being updated.
Event Payload:
-
event
Booleantrue if updating; false if not
Datagrid.ZOOMLIGHTROW_HIDE
Dehighlights the currently zoomlighted row.