FCC.TableImport documentation

Table of content

Summary

Allows the import of text representation of tabular data.

Properties

types

Object that contains type Objects that represent types available for the columns in TableImport.

Type Objects contain two properties - l for the level and s for the string representation of the type.

Methods

cellType ( value )

Determines what type the passed value is.

Returns a type Object.

colType ( column )

Determines what type the data in the passed column Array is.

Returns a type Object.

convert ( text [, divider [, header [, types]]] )

Converts the passed text into an object with at most three properties:

  • data contains the Array of Arrays (no header row) or Objects (with header row) containing the data of the table,
  • header contains the Array of header cell titles (the header Array is not present when a header row does not exist),
  • types contains the Array of type Objects of the corresponding columns.

Optional parameters set the divider String (defaults to a tab character), the presence of a header row (Boolean) and sets the Array of types of the columns in the table. The latter should be an Array of type keywords. For supported types check the types property.

Returns an Object.

convert2JSON ( text [, divider [, header [, types]]] )

Passes all the parameters to convert to get the Object and then calls the toJSONString on it.

Returns a String.

convert2Table ( text [, divider [, header [, types]]] )

Passes all the parameters to convert and then uses the returned Object to create an html table.

The table is returned with thead if header row exists and tbody that contains the data.

Returns HTMLTableElement.

convert2Input ( text [, divider [, header [, types]]] )

Passes all the parameters to convert and then uses the returned Object to create a fieldset with input elements that contain the data.

The input elements are named 'header_'+i for headers and 'cell_'+r+'_'+i for data. Types are also returned as 'type_'+i.

Returns HTMLFieldsetElement.

convertRow ( row, types )

Converts the row Array from String (input type) to a specified type set in the types Array.

Returns Array.

fillRow ( row, cols, header )

Fills the passed row Array so that it contains the exact number of columns set by the cols Integer. If the header Boolean is set to true the values for the header row are used as fill-ins.

Returns Array.

findNewline ( text )

Finds the characters that split rows in text String - can be any combination of CR and LF.

Returns String.

hasHeader ( firstrow, types )

Determines if the first row passed in as the firstrow Array is a header row by comparing the cell types and the corresponding column types passed in through the types Array.

Returns Boolean.

splitCells ( text, divider )

Splits the text String using the divider String.

Returns Array.

splitRows ( text )

Splits the text String into an Array of lines.

Returns Array.