You are on page 1of 12

Grid Control API Page 1 of 12

.NET Customisation User Guide

.NET Customisation : AVEVA C# Grid Control : Grid Control API

Grid Control API


The following table includes the API calls which have been made available for the Grid Control.
Note: Not all of the API calls have been exposed for PML use.
Note: You can only use the AVEVA C# Grid Control on your own Visual Studio form if you have a design time
license for Infragistics.

Name Type Purpose

Data Source methods for populating the grid

BindToDataSource(NetDataSource) Bind Grid to NetDataSource.

BindToDataSource(NetDataSource Bind Grid to NetDataSource.


(Boolean)
Boolean - keepColumnWidths.

NetDataSource(String TableName, Data Source constructor for database Attributes and database
Array Attributes, Array AttributeTitles, elements. The Grid will populate itself with database
Array Elements) values. The title of each column is represented by
AttributeTitles.

NetDataSource(String TableName, Data Source constructor for database Attributes and database
Array Attributes, Array Elements) elements. The Grid will populate itself with database
values.

NetDataSource(String TableName, Data Source constructor for database Attributes and database
Array Attributes, Array Elements, elements. The Grid will populate itself with database
String Tooltips) values.

NetDataSource(String TableName, Data Source constructor for column headings, and a set of
Array columns, Array of Array of rows) row data. In this case the grid does NOT populate itself with
database attribute values.

NetDataSource(String TableName, Data Source constructor for column headings, and a set of
Array columns, Array of Array of rows, row data. In this case the grid does NOT populate itself with
String Tooltips) database attribute values.

NetDataSource(String TableName, Data Source constructor for import of an Excel or CSV File
string PathName)

General methods available for the grid

AlignGroupHeaderVertcally(string Vertically align the group header (Bottom, Top,


GroupName, string Align) Default).

allGridEvents() Query whether grid events are on or off

allGridEvents(Boolean)allGridEvents Switch Grid Events On or Off.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 2 of 12

(Boolean)

AllowDropInGrid() Query AllowDropInGrid.

AllowDropInGrid(Boolean) Allow drag/drop in the grid.

BulkEditableGrid() Query BulkEditableGrid.

BulkEditableGrid(Boolean) Allow/disallow cells to be bulk editable. Bulk edit mode allows


multiple cells to be selected, and Fill down/Fill up operations
to be performed. Copy and Paste operations will also apply to
multiple cells selected in the same column.

ClearGrid() Remove data & column headings.

ClearGridData() Remove all of the row data from the grid.

ColumnExcelFilter() Query ColumnExcelFilter.

ColumnExcelFilter(Boolean) Allow/disallow Excel style filter on columns.

ExcelFilterCaseSensitivity() Query ExcelFilterCaseSensitivity.

ExcelFilterCaseSensitivity(Boolean) Set Excel column filter to be case sensitive or not. Default is


TRUE (case sensitive)

ColumnSetup() Display the column setup form.

ColumnSummaries() Query columnSummaries.

ColumnSummaries(Boolean) Allow/disallow Average, Count, etc on numeric columns

createValueList(String Name, Array for Create a value list for the grid.
List)

DisplayNulrefAs() Query DisplayNumrefAs.

DisplayNulrefAs(String) Nominate (or query) a text string to be used in grid cells that
hold "Nulref" reference attribute data.

DisplayUnsetAs() Query DisplayUnsetAs.

DisplayUnsetAs(String) Nominate (or query) a text string to be used in grid cells that
hold "unset" attribute data.

EditableGrid() Query EditableGrid

EditableGrid(Boolean) Allow/disallow cells to be editable.


Note: If the user is allowed to write data to the grid, then this
data does not automatically get written back to the data
source (or database). The BeforeCellUpdate event of
the calling code is responsible for doing this
synchronisation, and is in control of whether to either
allow or disallow the change (Refer to Add an Event to
the Addin for further information). This does not enable
the user to add/remove rows, just to edit the content of

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 3 of 12

the existing cells.

ErrorIcon() Query ErrorIcon.

ErrorIcon(Boolean) Allow/disallow the display of the red icon in the cell if an


attribute value or expression cannot be computed.

FeedbackFailColor() Query FeedbackFailColor.

FeedbackFailColor(String) Nominate (or query) the colour used to highlight cells where
editing fails.

FeedbackSuccessColor() Query FeedbackSuccessColor

FeedbackSuccessColor(String) Nominate (or query) the colour used to highlight cells


successfully edited.

FixedHeaders() Query FixedHeaders.

FixedHeaders(Boolean) Allow/disallow fixed headers. (Useful when scrolling).

FixedRows() Query FixedRows.

FixedRows(Boolean) Allow/disallow fixing of rows (Useful when scrolling).

getDataSource() NetDataSource Returns the data source that has been set in the grid.

getGroups Returns list of groups used in grid.

GetGroupOrigin(string grKey) Return the origin of the given group.

GetGroupSpan(string grKey) Return the span of the given group.

GridHeight() Real Query GridHeight.

GridHeight(Real) Set the height of the rows in the grid.

getParentGroupForGroup(string Returns parent's group name for given group.


groupName)

getParentGroupForColumn(string Returns parent's group name for given column.


colName)

GroupMoving(String) Set the moving of groups to: Default, NotAllowed, WithinBand


or WithinGroup.

HeaderSort() Query HeaderSort.

HeaderSort(Boolean) Allow/disallow the user to sort columns.

HideGroupByBox() Query HideGroupByBox.

HideGroupByBox(Boolean) Hide/show the groupBy box.

loadFromMemoryStream(object data) Load the grid from a stored memory stream.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 4 of 12

loadGridFromXML(string xmlFile) Load the grid from an XML file.

loadGridLayout(object gridLayout) Load the stored layout of a grid.

loadLayoutFromXml(String) Load a stored grid layout into the current grid instance.

OutlookGroupStyle Query OutlookGroupStyle.

OutlookGroupStyle(Boolean) Allow/disallow the Outlook Group style feature.

printPreview() Opens a Print Preview of the grid instance (which also allows
printing).

QuickReport() Create a quick report from the current grid.

ReadOnlyCellColor() Query ReadOnlyCellColor.

ReadOnlyCellColor(String) Nominate (or query) the background colour used to indicate


cells where editing is not permitted.

RefreshAllFilters() Refresh all the filters in the grid.

RefreshTable() For a grid displaying Dabacon data this recalculates the


content of every cell to refresh to the latest database state.

RefreshVisibleRegion() For a grid displaying Dabacon data this recalculates the


content of every cell in the visible region to refresh to
latest database state.

resetCellFeedback() Reset the cell editing feedback highlight colour and tooltip
text.

ResetColumnProperties() Reset column layout.

ResetGridOrder() Reset the order of the columns in the grid.

saveGridToExcel(string excelFile) Save the grid data to an Excel file.


Note: This will retain all grid groupings and layout of data.
The String should specify the full pathname.

saveGridToExcel(string excelFile, Save the grid data to a designated worksheet of an Excel file.
string worksheet) Note that this will retain all grid groupings and layout of

saveGridToExcel(string Save the grid data to a designated worksheet of an Excel file.


excelFile,string worksheet, string Here strHeader is a user supplied string which is output to
strHeader) first row in the Excel spreadsheet. The grid data is then output
starting in row #2.

SaveLayoutToXml(String) Save the grid layout (not data) to a file on the file system.

saveToMemoryStream(ref Save the grid to a memory stream.


MemoryStream stream)

setAlternateRowColor(Red Num, Set alternate rows of the grid to a different colour. The default
Green Num, Blue Num) is: (251, 251, 255).

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 5 of 12

setAlternateRowColor(String) Set alternate rows of the grid to a different colour.

setLabelVisibility(Boolean) Show/hide the label which indicates the number of rows in the
grid.

SingleRowSelection() Query SingleRowSelection.

SingleRowSelection(Boolean) Set grid to single row selection.

splitGrid(Boolean) Allow/disallow the user to split the grid horizontally and


vertically.

SetGroupOrigin(string grKey, Point Set of the {x,y} origin of the given group.
value)

storeGridLayout() Store the layout of the grid.

SetGroupSpan(string grKey, Point Set of the {x,y} span of the given group.
value)

SyntaxErrorColor() Query SyntaxErrorColor.

SyntaxErrorColor(String) Nominate (or query) the colour used to highlight cells


containing syntactically invalid data.

Methods on rows in the grid

addRow(Array) Add a single row of data. If the grid is based on database


elements then the first element of the array is read. If not,
the Array data represents the data in each cell of the row.

clearRowSelection() Clear row selection.

deleteRows(Array) Delete one or more rows by row tag.

deleteSelectedRows() Delete selected rows.

GetFilteredInRows() Array Return the rows which are contained in the current filter.

GetFilteredOutRows() Array Return the rows which are not contained in the current filter.

getNumberRows() Real Get the number of rows in the grid.

getNumberSelectedRows Real Get the number of selected rows in the grid.

getRow(Real) Get the row data.

getRow(string row) Array Get the cells in the row with the specified row tag.

getRowNumFromTag(string rowTag) Get the row number from the row tag.

getRows() Array of Array Returns an array of all the row data.


(rows)

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 6 of 12

getRowTag(Real) Get the row tag.

getRowTagByListIndex(Real) Get the row tag by list index.

GetSelectedRows() Array of Array Returns array of selected rows.


(rows)

GetSelectedRowColumn(row, Get the row and column of the selected row.


column))

getSelectedRowTags() Array of row Get the selected row tags.


tags

getVisibleIndexOfRow(string Get the visible index of the row.


strRowTag)

HasFilteredRows(Boolean) Set whether the grid has filtered rows.

isRowVisible(Real) Is the given row visible.

MoveRowToPosition(Real, Real) Move a row to a given position in the grid.

MoveRowToPosition(String, Real) Move a row to a given position in the grid.

MoveSelectedRowsDown() Move the selected rows down in the grid.

MoveSelectedRowsUp() Move the selected rows up in the grid.

returnSelectedRows(Array) Return the selected rows.

RowAddDeleteGrid() Query RowAddDeleteGrid.

RowAddDeleteGrid(Boolean) Enable/disable row addition and deletion in the grid.

ScrollSelectedRowToView() Query ScrollSelectedRowToView.

ScrollSelectedRowToView(Boolean) Scroll the selected row into view.

selectAllRows() Select all the rows in the grid.

selectRow(Real) Select the given row.

setEditableRow(Real, Set the given row as editable or not.


BoolenanBoolean)

setRowColor(Real, string Set the colour of the row to the named value.
strColorcolour)

SetRowColor(string rowTag, string Set the colour of the row to the named value.
colour)

SetRowColor(string row, real red, real Set the colour of the row to the RGB value.
green, real blue)

setRowTooltip(Real, string tooltip) Set row tooltip to the specified string.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 7 of 12

setRowTooltip(string row, string Set row tooltip to the specified string.


tooltip)

setRowVisibility(Real, Boolean) Set the visibility of the row.

setSelectedRows(Array) Select the given rows.

setSelectedRowTags(Array) Programmatically select the given row tags.

Methods on columns in the grid

AlignColumnHeaderVertcally(string Align the given column header vertically: Default, Top, Middle
ColumnName, string Align) or Bottom.

assignBiCheckboxToColumn(Real) Assign a bi-checkbox to the given column.

assignDataTypeToColumn(Real) Assign data type “double” to the given column.

assignOptionSetToColumn(Real) Assign a Yes/No option set to the given column.

assignValueListToColumn(String, Assign a value list (string) to the given column.


Real)

AutoFitColumns() Resize columns to fit widest text.

CheckFixedHeaderIndicatorOnColumn Query FixedHeaderIndicatorOn Column.


(String)

CheckFixedHeaderOn Column(String) Query FixedHeaderOnColumn.

ColumnsInGroupByBox() Boolean Returns true if there is at least one column in the GroupBy
box.

ColumnMoving(String) Allow/disallow column moving on the given column.

ColumnDisplayedAndSortedAscending Set given column as displayed and sorted in ascending order.


(string key)

ExtendLastColumn() Query ExtendLastColumn.

ExtendLastColumn(Boolean) Extend the last column.

FixedHeaderIndicatorOn Column Set fixed header indicator on the given column.


(string column, Boolean)

FixedHeaderOnColumn(string column, Fix the header on the column.


Boolean)

getColumn(Real) Get the cells in the column.

getColumn(string column) Array Get the cells in the column with a specified tag.

GetColumnIndex(string colKey) Get the column index of the given column.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 8 of 12

getColumnKey(Real) Get the key of the given column.

getColumnMask (Real) Get the mask of the given column.

GetColumnOrigin(string colKey) Get the column origin of the given column.

getColumnPosition(string column) Real Get the position of the column with the specified tag.

GetColumnSpan(string colKey) Get the span of the given column.

GetColumnTitle(string column) String Get the title of the column with the specified tag.

getColumns() Array of Get the columns in the grid.


STRING

getColumnsWithFilters() Array of Get the columns in the grid with filters.


STRING

getTitles() Array of strings Get the titles for the columns in the grid.

getNumberColumns() REAL Return the number of columns.

GetSetFiltersOfGivenColumn(string Get filters that are set in given column name.


col) q var !!
PMLGridExample.grid.GETSETFILTERSOFGIVENCOLUMN
(!columnName)

getUserColumns() Array Get the columns in the column setup window.

GetUserColumnSpecifications Array Get the column specifications in the column setup window.

getUserTitles() Array Get the column titles in the column setup window.

Hashtable GetColumnsWithFilters() Return all columns in the grid with filters.

isColumnVisible(Real) Boolean Query the visibility of the given column.

isColumnVisible(string column) Boolean Query the visibility of the specified column.

ResetColumnFilters() Reset all of the column filters.

ResizeAllColumns() Resize columns to fit in available width of form.

selectCell (Real, Real, Boolean) Select/deselect the cell (row, column).

setColumnColor (Real, string colour) Set the column colour to a string.

setColumnColor(string column, string Set the column colour to a string, for example, red.
colour)

setColumnImage(Real, string Set the column image.


strImageFile)

setColumnMask(Real, string strMask) Set the column mask.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 9 of 12

SetColumnOrigin(string colKey, Point Set the origin of the given column.


value)

setColumnPosition(string, realPoint Set the position of the given column.


value)

SetColumnSpan(string colKey, Point Set the span of the given column.


value)

setColumnTextAlignment(string Set the alignment of text in the column to CENTRE, CENTER,


column, string alignment) LEFT or RIGHT

setColumnVisibility(Real, Boolean) Show/hide the specified column.

setColumnVisibility(String, Boolean) Show/hide the specified column.

SetColumnWidth(Real, Real) Set the column to a designated width.

SetColumnWidth(string column, real Set the column to a designated width.


width)

setColumnsWithFilters(Array) Set the columns in the grid with the specified filters.

SetColumnWithFilters(string colName, Set the column in the grid with specified filters and column
Hashtable paramValues) names. This function requires to set columns and values in
correct order, otherwise it won't set correctly
show !!PMLGridExample
!x[0] = '/E1301'
!x[1] = '/C1101'
!y[0] = 'EQUI'
!z[0] = !x
!z[1] = !y
!columnsName[0] = 'Name'
!columnsName[1] = 'Type'
q var !!
PMLGridExample.grid.SETCOLUMNSWITHFILTERS(!
columnsName,!z)

SetColumnWithFilters(string colName, Set the column in the grid with the specified filters.
Hashtable paramValues)
show !!PMLGridExample
!values = object array()
!values[0] = '/E1301'
!values[1] = '/C1101'
!values[2] = '/1302A'
!columnName = 'Name'
q var !!
PMLGridExample.grid.SETCOLUMNWITHFILTERS(!
columnName,!values)

setEditableColumn(Real, Boolean) Set the given column to be editable/uneditable.

setGroupByColumn(Real, Boolean) Set the ability to group by column.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 10 of 12

setNameColumnImage() Displays standard icons in a "NAME" attribute column when


database elements are used.

setNameColumnImage(boolean Displays standard icons in a "NAME" attribute column when


keepColumnWidth) database elements are used.
Additional parameter to set whether or not to maintain the
column width.

sortColumnAscending(String) Sort in ascending order the specified column.

sortColumnsAscending(Array) Sort in ascending order the specified columns.

SortedColumnCollection() Array Get the sorted columns,

unsetNameColumnImage() Remove the standard icons in the “NAME” attribute column


when database elements are used.

Methods on cells in the grid

assignValueListToCell(String, Real, Assign the given value list to the cell (row, column).
Real)

DoDabaconCellUpdate(Array args) This function is provided to support user code


BeforeCellUpdate event when the grid is displaying Dabacon
element/attribute data. The array provided as argument to the
BeforeCellUpdate event can be passed on to this function to
modify the Dabacon element/attribute in synchronisation with
the cell data. If the function is unable to perform the
modification for any reason the Array[3] and Array[4] values
will be set to indicate the problem. Refer to Add an Event to
the Addin for further information.

DoDabaconElementCopy(Array args) Do a Dabacon Element copy.

DoDabaconElementCreateAtPosition Do a Dabacon Element create at position in the hierarchy.


(Array args)

DoDabaconElementCreateFirst(Array Do a Dabacon Element create at the first position in the


args) hierarchy.

DoDabaconElementCreateLast(Array Do a Dabacon Element create at the last position in the


args) hierarchy.

DoDabaconElementDelete(Array args) Do a Dabacon Element delete.

DoDabaconElementOrderUpdate Do a Dabacon element order update.


(Array args)

getCell(Real, Real) Get the content of the cell in the specified row and column.

getCell(string rowTag, string STRING Get the content of the cell in the specified row and column.
columnTag)

getCellByListIndex(string rowTag, Get the cell by list index.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 11 of 12

string colTag)

isEditableCell(string strRowTag, string Boolean Get whether or not the cell is editable.
strColTag)

removeValueListFromCell (Real, Real) Remove the value list from the cell.

setCellColor(string rowTag, string Set the colour of a cell, for example: red.
columnTag, string colour)

setCellColor(string rowTag, string Set the colour of the cell to the RGB value.
columnTag, real red, real green, real
blue)

setCellColor(Real, Real, Real, Real, Set the colour of the cell to the RGB value.
Real, Real)

setCellColor(Real, Real, String) Set the colour of the cell.

setCellImage(Real, Real, String) Set the image of the cell.

setCellImage(Real, Real, Image) Set the image of the cell.

setCellTextAlignment(string rowTag, Set the alignment of text in the cell to CENTRE, CENTER,
string columnTag, string alignment), LEFT or RIGHT.
where alignment=CENTRE, CENTER,
LEFT, RIGHT

setCellTooltip(Real, Real, string Set the tooltip of the cell.


strToolTip)

setCellValue(Real, Real, string strVal) Set the value of the cell.

setCellValue(string rowTag, string Set a value in the cell.


columnTag, string value)

setCellValueByListIndex (Real, Real, Set a value in the cell by list index.


string strVal)

setCellValueByListIndex(string Set a value in the cell by list index.


rowTag, string columnTag, string
value)

setEditableCell(Real, Real, Boolean Enable/disable cell editing.


editable)

setEditableCell(string rowTag, string Enable/disable cell editing.


columnTag, Boolean editable)

setSelectedCellsValue(string strVal) Set the value for all selected cells.

Other methods

Updates() Query updates.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022
Grid Control API Page 12 of 12

Updates(Boolean) Set whether or not database updates should be applied to the


grid.

setErrorIcon(Image, Image) Set the image of the icon to appear in a Dabacon grid when
an error is generated.

LayoutFromColumnSpecs(bool Refresh layout of all columns.


keepColumnWidths)

MenuTool PopupMenu Set the popup menu for the grid.

MenuTool PopupMenuHeader Set the popup menu for the header of the grid.

RefreshGroupSort() Refresh group sort (can be used when a new item is added).

CellSort : IComparer The IComparer class to sort two grid cells.

Compare(object x, object y) The compare algorithm to sort two grid cells

SuspendUpdates(Boolean) Suspend updates to the grid.

DisplayStyle CellValueListDisplayStyle The cell Value List display style (Always, OnMouseEnter,
OnCellActivate, OnRowActivate).

Dictionary<string, ColumnLayout> Gets the layout detail for each column.


GetCurrentColumnLayout()

1974 to current year. AVEVA Solutions Limited and its subsidiaries. All rights reserved.

https://help.aveva.com/AVEVA_E3D_Design/2.1.0.34/NCUG/NCUG6.08.09.html 05-10-2022

You might also like