Module: fields

Members

(static) titleize

Used by getSchema. Override as needed for different titleization flavor.

Methods

(static) decorateColumnSchema(schema, headerifierNameopt) → {Array.<columnSchema>}

Decorate each element of schema with:

  • header property (when undefined)
Parameters:
Name Type Attributes Description
schema Array.<columnSchema>
headerifierName string <optional>

Name of string transformer to use to generate headers (from column names) for those columns without defined headers. If omitted or undefined, no decoration takes place.

Returns:

The given schema.

Type
Array.<columnSchema>

(static) decorateSchema(schema) → {Array.<columnSchema>}

Decorate given grid schema with:

  • Synonym(s) based on name property of each element:
Parameters:
Name Type Description
schema Array.<columnSchema>
Returns:

The given schema.

Type
Array.<columnSchema>

(static) getFieldNames(hash) → {Array.<string>}

Get keys of given hash with "metakeys" filtered out.

Metakeys are keys beginning with a double-underscore.

DO NOT REMOVE -- Not used in fin-hypergrid/core but has legacy exposure.

Parameters:
Name Type Description
hash object
Returns:

Member names from hash that do not begin with double-underscore.

Type
Array.<string>

(static) getSchema(dataopt) → {Array.<columnSchema>}

Returns a schema derived from given sample data row with "metakeys" filtered out.

Metakeys are keys beginning with a double-underscore.

DO NOT REMOVE -- Not used in fin-hypergrid/core but has legacy exposure.

Parameters:
Name Type Attributes Description
data Array.<dataRowObject> <optional>
Returns:

Array object also decroated with synonyms for elements.

Type
Array.<columnSchema>

(static) normalizeSchema(schema) → {Array.<columnSchema>}

Normalizes and returns given schema array.

For each "column schema" (element of schema array):

  1. Objectify column schemata
    Ensures each column schema is an object with a name property.
  2. Index schema schemata
    Adds an index property to each column schema element.
  3. Decorates schema
    Decorates the schema array object itself with column names and column name synonyms. This is helpful for looking up column schema by column name rather than by index. To get the index of a column when you know the name:
    var schema = dataModel.getSchema();
    var columnName = 'foo';
    var columnIndex = schema[columnName].index;
  4. Adds missing headers.

This function is safe to call repeatedly.

Called from createColumns (called on receipt of the fin-hypergrid-schema-loaded event (dispatched by data model implementation of setSchema)).

Parameters:
Name Type Description
schema Array.<rawColumnSchema>
Returns:
Type
Array.<columnSchema>