GridView

Type: GridView

Extends View

Script class of the GridView view.

Properties

PropertyDescription
Since version 4.04.23, Named properties may be accessed directly instead of requiring getViewProperty / setViewProperty. The property ID may be identified in the Properties view.
enabled Enables/disables the view.
columns Get/Set the columns for the view. Note that the columns may also be set via the 'data' property.
data Get/Set the data for the view. This may be specified as an array of rows or an object, with a 'data' property for the rows (an array). Each row is an array of objects for each cell in the row. The columns may be specified via the 'columns' property, if using an object, specified like a row. Cell objects may have any of the following properties, which may be specified as functions or values.
  • checked - For cells with checkboxes, indicates if cell should be checked. Else uses 'value'.
  • value - the value of the cell.
  • setter - function to accept value from cell editor.
  • editorOptions - If specified, the cell editor will be a drop-down with the specified values. This may be an array of values or an array of objects of the form { text: "text", value: "value" }. A function may also be specified that returns such a structure.
  • text - the text to display in the cell. value will be used if text not provided.
  • option - name or instance of an ecu.option. Many fields are populated from the object, unless overidden.
  • channel - name or instance of an ecu.channel. Many fields are populated from the object, unless overidden.
  • object - instance of an ecu object (e.g. ecu.option). Many fields are populated from the object, unless overidden.
  • description - Description text.
  • toolTip - Tool tip to show when cell is hovered.
  • statusTip - Tip to show in status bar when cell is hovered.
  • userText - User text value.
  • tag - Column tag, used for persistence of column widths.
  • icon - the icon to display in the cell.
  • iconExpanded - the icon to display in the cell if it is expanded (tree views).
  • colSpan - number of columns spanned by the cell.
  • rowSpan - number of rows spanned by the cell.
  • color - the color to display in the cell.
  • backgroundColor - the background color to display in the cell.
  • userValue - User value.
  • sortKey - If sorting the column, this value is used in preference to 'text' or 'value'
  • isSelectable - Indicates if the cell may be selected
  • isEditable - Indicates if the cell may be edited
  • isEnabled - Indicates if the cell is enabled
  • isDisabled - Indicates if the cell is disabled
  • isDefault - Indicates if the cell is a default value
  • isCheckable - Indicates if the cell is checkable (should display a checkbox)
  • isUserCheckDisabled - Indicates if the isCheckable cells checkbox may be checked/unchecked by the user
selected Get/Set the selected sites, as a JSON string, scripts can use JSON.parse.

View Properties

Properties defined by the view that are normally editable via properties editor.

PropertyNameDescription
title Title The title of the window.
id Script ID The scripting ID of the window. Can be used as an alternative to the title for searching for windows from scripts.
tooltip Tool Tip Window tool tip.
show_header Show Header Controls whether the column header is displayed.
column_widths_settings_key Column Widths Settings Key If set, user-configured column widths are stored in the application settings for the given key
selected Selected Selected cells.

Methods

MethodDescription
callListener(eventName, [args]) Calls all event listeners for the given event name, useful for testing.
getParent() Get the parent window/view (if any) of this view.
getViewProperties() Returns an array of objects containing the view properties. Each element has the fields 'name', 'id', 'value', 'hint'. If the property is a category then it will also have an array field 'properties'. These properties are the ones normally editable via the properties view.
getViewProperty(id) Gets a property value from the view, given the property ID. Property IDs can be listed using getViewProperties. These properties are the ones normally editable via the properties view.
on(eventName, callback) Adds an event listener for the given event name. e.g. view.on("click", function() { ... });
pxFromDimension(dimension) Convert a dimension string (e.g. "10em", "50dp", "100px") into pixel units, relative to the view object.

Returns the size in pixels.

removeAllListeners([eventName]) Removes all event listeners for the given event name. If the event name is not given then all listeners for all events are removed.
removeListener(eventName, callback) Removes an event listener for the given event name. e.g. let callback = function() { ... }; view.on("click", callback); view.removeListener("click", callback);
setViewProperty(id, value) Sets a property on the view, given the property ID and value. Property IDs can be listed using getViewProperties These properties are the ones normally editable via the properties view.
refresh() Refresh the view, invalidating any cached values.