DataTable

parasql.schema. DataTable

The DataTable class is a container for row objects and column objects. The row objects contain the data and the column objects contain the metadata about the column.

Constructor

new DataTable()

License:
Example
// get the first for from myDataWidget
let dataRow = myDataWidget.getDataTable().getRowAt(0); 

Extends

  • Object

Members

columns :Array.<parasql.schema.ColumnInfo>

Type:

rows :Array.<parasql.schema.DataRow>

Type:

Methods

addNewColumn(columnName, datatype) → {parasql.schema.ColumnInfo}

Parameters:
Name Type Description
columnName string
datatype string

A valid database datatype (e.g. varchar, double, int)

Returns:
Type
parasql.schema.ColumnInfo

appendNewRow() → {parasql.schema.DataRow}

Adds a new row to the end of this DataTable.

Description:
  • Adds a new row to the end of this DataTable.

Returns:

The newly added row.

Type
parasql.schema.DataRow

clearAllRows()

Clears all rows from this DataTable.

Description:
  • Clears all rows from this DataTable.

discardChanges()

Tells each Row in this DataTable to discardChanges.

Description:
  • Tells each Row in this DataTable to discardChanges.

getColumns() → {Array.<parasql.schema.ColumnInfo>}

Returns:
Type
Array.<parasql.schema.ColumnInfo>

getIndexOf(columnName) → {number}

Parameters:
Name Type Description
columnName string

The name of the column.

Returns:

The index of the column with the specified name, or -1 if no matching column was found.

Type
number

getRowAt(index) → {parasql.schema.DataRow}

Parameters:
Name Type Description
index number

The index of the row to return. The first row is 0.

Returns:
Type
parasql.schema.DataRow

getRowCount() → {number}

Returns:

The number of rows in this DataTable.

Type
number

getRows() → {Array.<parasql.schema.DataRow>}

Returns:
Type
Array.<parasql.schema.DataRow>

getTotalRowCount() → {number}

This value is only set if SQL_CALC_FOUND_ROWS was used.

Description:
  • This value is only set if SQL_CALC_FOUND_ROWS was used.

Returns:

The total number of rows that would have been retrieved if no LIMIT clause was used; this is an optionally calculated number and will be -1 if not set.

Type
number

getValue(rowIndex, colName) → {parasql.schema.DataValue}

Parameters:
Name Type Description
rowIndex number

The first row in the table has index = 0

colName string

The column name

Returns:
Type
parasql.schema.DataValue

insertRowAt(index) → {parasql.schema.DataRow}

Parameters:
Name Type Description
index number

The position of the newly inserted row within this DataTable; index must be between 0 and DataTable.rows.length inclusive.

Returns:

The newly inserted row.

Type
parasql.schema.DataRow

isDirty() → {boolean}

Returns:

Returns true if this DataTable is dirty (contains new rows, deleted rows, or rows with changed values).

Type
boolean

markAsSaved()

Marks this DataTable as having saved it changes to the database.

Description:
  • Marks this DataTable as having saved it changes to the database.

toCSV(optionsnullable) → {string}

Generates a CSV representation of this DataTable.

Description:
  • Generates a CSV representation of this DataTable.

    See IETF RFC 4180 for official CSV format: http://tools.ietf.org/html/rfc4180#page-2

Parameters:
Name Type Attributes Description
options Object <nullable>
Properties
Name Type Description
excludeHeader boolean

If true the header row will be excluded.

fieldDelimiter string

Specify a custom field delimiter; the default is the comma character.

Returns:

The CSV representation of this DataTable.

Type
string