/table_editor

Primary LanguageJavaScriptMIT LicenseMIT

Table Editor

Table Editor to make main operation with file of table, that has delimiter - tab. Possible operation:

  • upload selected file to editor
  • download changed file
  • browse content of table
  • change content of rows in table
  • change name of file with table
  • sort columns of table

API

Table of Contents

readFile

Start function of app, execute all main operation with file

Parameters

  • input pbject html object - selected file to work with

Editor

Class representing a tool Editor

Parameters

parseFile

Convert a file into two arrays: array of rows of the table and array of the headers of the table

Parameters

Returns object Object with fields: data(rows) and headers

tableToText

Convert a table from html to string with tabs for saving in the file

Parameters

  • headers object array of headers of the table
  • rows object array of rows of the table

Returns string String containing table with tabs, ready to download

download

Method for downloading the table

Parameters

  • filename string name of file to save
  • text string file to save

Table

Class representing a Table

Parameters

createHeader

Create a header of table

Parameters

  • array object Array of headers of the table

createRow

Create rows of table

Parameters

sortTableByColumn

Sort the table

Parameters

  • column int Number of column, that is sorted
  • asc boolean Identifier for sorting in direct or reverse order (optional, default true)

openModal

Create a modal window

Parameters

  • options object Object with fields: {argForFn, defaultValue, fnForBtn, headerText, btnText}