Skip to main content
Version: 7.9

Table Scripting Functions

This page details the various component and extension functions available for Vision's Table component.

Component Functions

.addRow(newRow)

  • Description
    • Adds a new row to the end of the table's dataset
  • Parameters
    • PySequence newRow - A sequence containing the values for the new row. The length of the sequence must match the number of columns in the table, and each value must be coercible into the correct datatype of the corresponding column.
  • Return
    • Nothing
  • Scope
    • Client

.deleteRow(rowIndex)

  • Description
    • Deletes a row from the table's dataset.
  • Parameters
    • int rowIndex - The index of the row to delete.
  • Return
    • Nothing
  • Scope
    • Client

.exportCSV(filename, showHeaders)

  • Description Prompts the user to save the table's data as a CSV file.
  • Parameters
    • String filename - A suggested filename for the user. For example: "table_data.csv"
    • boolean showHeaders - If true, include headers in CSV file.
  • Return
    • String - The path to the saved file, or null if the operation was cancelled.
  • Scope
    • Client

.exportHTML(filename, headerName, cellSpacing)

  • Description
    • Prompts the user to save the table's data as an HTML file.
  • Parameters
    • String filename - A suggested filename for the user. For example: "table_data.html"
    • String headerName - A name for the HTML header.
    • Int cellSpacing - A table width in pixels.
  • Return
    • String - The path to the saved file, or null if the operation was cancelled.
  • Scope
    • Client

.getDataAsHTML(title, width)

  • Description
    • Creates an HTML page as a string in memory. This can then be written to a file, a database, emailed, etc.
  • Parameters
    • String title - The title for the HTML page.
    • int width - The width (in pixels) for the "table" element in the resulting html page.
  • Return
    • String - A string containing an HTML-formatted version of the table's data.
  • Scope
    • Client

.getRowsInViewOrder()

  • Description
    • Returns a list of ints that represent the underlying dataset's rows as they appear in the current sort order that the user is viewing.
  • Parameters
    • none
  • Return
    • List of Integers
  • Scope
    • Client

.getSelectedColumn()

  • Description
    • Returns the index of the currently selected column, or -1 if none is selected.
  • Parameters
    • none
  • Return
    • int
  • Scope
    • Client

.getSelectedColumnCount()

  • Description
    • Returns the number of columns that are currently selected.
  • Parameters
    • none
  • Return
    • int
  • Scope
    • Client

.getSelectedRow()

  • Description
    • Returns the index of the currently selected row, or -1 if none is selected.
  • Parameters
    • none
  • Return
    • int
  • Scope
    • Client

.getSelectedRows()

  • Description
    • Returns a list of the indexes of the selected row, or none if none is selected.
  • Parameters
    • none
  • Return
    • List, None
  • Scope
    • Client

.getSelectedRowCount()

  • Description
    • Returns the number of rows that are currently selected.
  • Parameters
    • none
  • Return
    • int
  • Scope
    • Client

.isCellSelected(row, column)

  • Description
    • Tests whether the cell at the given row and column is currently selected or not.
  • Parameters
    • int row - The row to test.
    • int column - The column to test.
  • Return
    • boolean
  • Scope
    • Client

.isColumnSelected(column)

  • Description
    • Tests whether the given column is currently selected or not.
  • Parameters
    • int column- The column to test.
  • Return
    • boolean
  • Scope
    • Client

.isRowSelected(row)

  • Description
    • Tests whether the given row is currently selected or not.
  • Parameters
    • int row - The row to test.
  • Return
    • boolean
  • Scope
    • Client

.print(fitWidth, headerFormat, footerFormat, showDialog, landscape)

  • Description
    • This specialized print function will paginate the table onto multiple pages.This function accepts keyword-style invocation.
  • Keyword Args
    • boolean fitWidth- If true, the table's width will be stretched to fit across one page's width. Rows will still paginate normally. If false, the table will paginate columns onto extra pages. (default = true) [optional]
    • string headerFormat- A string to use as the table's page header. The substring "{0}" will be replaced with the current page number. (default = None) [optional]
    • string footerFormat- A string to use as the table's page footer. The substring "{0}" will be replaced with the current page number. (default = "Page {0}") [optional]
    • boolean showDialog- Whether or not the print dialog should be shown to the user. Default is true. [optional]
    • boolean landscape- Used to specify portrait (0) or landscape (1) mode. Default is portrait (0). [optional]
  • Return
    • boolean- True if the print job was successful.
  • Scope
    • Client

.setColumnLabel(column, label)

  • Description
    • Used to set a column's header label to a new string at runtime.
  • Parameters
    • int column - The column index that will get a new headel label.
    • String label - The new header label.
  • Return
    • nothing
  • Scope
    • Client

.setColumnSelectionInterval(index0, index1)

  • Description
    • Sets the given range of columns to be selected. If index0==index1, it will select a single column.
  • Parameters
    • int index0 - the first index.
    • int index1 - the second index.
  • Return
    • boolean - True if selection range is valid.
  • Scope
    • Client

.setColumnWidth(column, width)

  • Description
    • Used to set a column's width at runtime.
  • Parameters
    • int column - The index of the column.
    • int width - The width to set it at in pixels.
  • Return
    • nothing
  • Scope
    • Client

.setRowSelectionInterval(index0, index1)

  • Description
    • Sets the given range of rows to be selected. If index0==index1, it will select a single row.
  • Parameters
    • int index0 - The first index.
    • int index1 - The second index.
  • Return
    • boolean - True if selection range is valid.
  • Scope
    • Client

.setSelectedColumn(column)

  • Description
    • Sets the given column to be the selected column.
  • Parameters
    • int column - Column to select.
  • Return
    • nothing
  • Scope
    • Client

.setSelectedRow(row)

  • Description
    • Sets the given row to be the selected row.
  • Parameters
    • int row - Row to select.
  • Return
    • nothing
  • Scope
    • Client

.setValue(row, column, value)

  • Description
    • Sets the value in the specified cell, altering the table's Data property. Will fire a propertyChange event for the "data" property, as well as a cellEdited event.
  • Parameters
    • int row - The index of the row to set the value at.
    • int column - The index or name of the column to set a value at.
    • PyObject value - The new value to use at the given row/column location.
  • Return
    • nothing
  • Scope
    • Client

.sortByColumn(columnName [, asc])

  • Description
    • Instructs the table to sort the data by the named column.
  • Parameters
    • String columnName - The name of the column.
    • boolean asc - 1 means ascending, 0 means descending. (default = 1) [optional]
  • Return
    • nothing
  • Scope
    • Client

.sortOriginal()

  • Description
    • Instructs the table to clear any custom sort columns and display the data as it is sorted in the underlying dataset.
  • Parameters
    • nothing
  • Return
    • nothing
  • Scope
    • Client

.updateRow(rowIndex, changes)

  • Description
    • Updates an entire row of the table's dataset.
  • Parameters
    • int rowIndex - The index of the row to update.
    • PyDictionary changes - A sequence containing the updated values for the row. The length of the sequence must match the number of columns in the table, and each value must be coercible into the correct datatype of the corresponding column.
  • Return
    • nothing
  • Scope
    • Client

Extension Functions

getBackgroundAt

  • Description
    • Called for each cell, returns the appropriate background color. Do not block, sleep, or execute any I/O; called on painting thread.
  • Keyword Args
    • Component self - A reference to the component that is invoking this function.
    • int row -The row index of the cell.
    • int col -The column index of the cell.
    • boolean isSelected - A boolean representing if the cell is currently selected.
    • Object value -The value in the table's dataset at index [row, col].
    • Color defaultColor -The color the table would have chosen if this function was not implemented.
  • Return
    • Color
  • Scope
    • Client

getForegroundAt

  • Description
    • Called for each cell, returns the appropriate foreground (text) color. Do not block, sleep, or execute any I/O; called on painting thread.
  • Keyword Args
    • Component self - A reference to the component that is invoking this function.
    • int row -The row index of the cell.
    • int col -The column index of the cell.
    • boolean isSelected - A boolean representing if the cell is currently selected.
    • Object value -The value in the table's dataset at index [row, col].
    • Color defaultColor -The color the table would have chosen if this function was not implemented.
  • Return
    • Color
  • Scope
    • Client

getDisplayTextAt

  • Description
    • Called for each cell, returns a String which will be used as the text of the cell. Do not block, sleep or execute any I/O; called on the painting thread.
  • Keyword Args
    • Component self - A reference to the component that is invoking this function.
    • int row -The row index of the cell.
    • int col -The column index of the cell.
    • boolean isSelected - A boolean representing if the cell is currently selected.
    • Object value -The value in the table's dataset at index [row, col].
    • String defaultText -The string the table would have chosen if this function was not implemented.
  • Return
    • String
  • Scope
    • Client