Class: DataSourceOrigin

DataSourceOrigin

new DataSourceOrigin()

See DataSourceOrigin#initialize for constructor parameters.

Members

schema :Array.<columnSchemaObject>

The array of column schema objects.

Type:

schema :Array.<columnSchemaObject>

The array of uniform data objects.

Type:

Methods

findRow(columnName, valueopt, replacementopt) → {object|number|undefined}

Find, replace, or update a row by it's primary key column.

Parameters:
Name Type Attributes Description
columnName string | object

One of:

  • string - Column name. See value.
  • object - Hash of 0 or more key-value pairs to search for.
value Array.<string> | * <optional>

One of: omitted - When columnName is a hash and you want to search all its keys. string[] - When columnName is a hash but you only want to search certain keys. otherwise - When columnName is a string. Value to search for. Note that null is a valid search value.

replacement object | null | undefined <optional>

One of:

  • omitted - Ignored.
  • object - Replacement for the data row if found.
  • null - Flag to delete the data row if found. The found data row is nonetheless returned.
  • undefined - Flag to return index of found row instead of row object itself.
To Do:
  • Use a binary search (rather than `Array..find`) when column is known to be indexed (sorted).
Returns:

One of:

  • undefined - data row not found
  • object - found data row object (will have been deleted if replacement was null)
  • number - index of found data row object in this.data (if replacement was undefined)
Type
object | number | undefined

findRowByIndex(index, replacementopt) → {object|number|undefined}

Find, replace, or update a row by it's index.

Parameters:
Name Type Attributes Description
index number

Row index that is being accessed

replacement object | null | undefined <optional>

One of:

  • omitted - Ignored.
  • object - Replacement for the data row if found.
  • null - Flag to delete the data row if found. The found data row is nonetheless returned.
  • undefined - Flag to delete the row at that index.
To Do:
  • Use a binary search (rather than `Array..find`) when column is known to be indexed (sorted).
Returns:

One of:

  • undefined - data row not found
  • object - found data row object (will have been deleted if replacement was null)
Type
object | number | undefined

getColumnCount() → {number}

Returns:
Type
number

getFields() → {Array.<number>}

Returns:
Type
Array.<number>

getHeaders() → {Array.<string>}

Returns:
Type
Array.<string>

getRow(y) → {dataRowObject}

Parameters:
Name Type Description
y
Returns:
Type
dataRowObject

getRowCount() → {number}

Returns:
Type
number

getSchema() → {Array.<columnSchemaObject>}

Returns:
Type
Array.<columnSchemaObject>

getValue(x, y) → {*}

Parameters:
Name Type Description
x
y
Returns:
Type
*

setData(dataopt, schemaopt)

Parameters:
Name Type Attributes Default Description
data Array.<object> <optional>
[]

Array of uniform objects containing the grid data.

schema Array.<columnSchemaObject> <optional>
[]

setFields(fields)

Parameters:
Name Type Description
fields Array.<string>

setHeaders(headersopt)

Parameters:
Name Type Attributes Description
headers Array.<string> <optional>

If omitted, headers will be reset to their derived defaults on next call to getHeaders.

setValue(x, y, value)

Parameters:
Name Type Description
x number
y number
value