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
- cacheSortedData
- capturePanel
- capturePanel
- createDatatable
- createRowPrototype
- deactivate
- fetchRecords
- generateToggleButtonDataForTemplate
- getDataObject
- getGraphicFromButton
- getNode
- handleGridEvent
- highlightrowHide
- highlightrowShow
- init
- init
- initListeners
- initScrollListeners
- initTooltips
- initUIListeners
- isReady
- isVisible
- navigateToRow
- refresh
- setButtonEvents
- updateDatasetSelectorState
- updateNotice
- zoomlightrowHide
- zoomlightrowShow
Properties
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
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 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 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:
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.
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.
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.
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
()
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
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.
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.ZOOMLIGHTROW_HIDE
Dehighlights the currently zoomlighted row.