presentation-table
Augmented.js Presentation Table View Module
API
Table of Contents
- AutomaticTable
- Parameters
- Examples
- theme
- linkable
- links
- selectable
- sortable
- sortStyle
- display
- renderPaginationControl
- paginationAPI
- description
- localStorage
- localStorageKey
- editable
- crossOrigin
- lineNumbers
- uri
- isInitalized
- pageControlBound
- schema
- name
- setTheme
- rowLink
- sortBy
- currentPage
- totalPages
- nextPage
- previousPage
- goToPage
- firstPage
- lastPage
- editCell
- copyCell
- clearCell
- render
- retrieveSchema
- fetch
- save
- populate
- clear
- refresh
- compileTemplate
- setURI
- setSchema
- showProgressBar
- showMessage
- validate
- isValid
- remove
- getSelected
- getSelectedAsJSON
- getSelectedIndex
- removeRows
- removeSelectedRows
- addRow
- exportTo
- BigDataTable
- EditableBigDataTable
- EditableLocalStorageTable
- EditableTable
- LocalStorageTable
- Spreadsheet
AutomaticTable
Extends DecoratorView
AutomaticTable
Creates a table automatically via a schema for defintion and a uri/json for data
Parameters
options(optional, default{})
Examples
const at = new AutomaticTable({
schema: schema,
el: "#autoTable",
crossOrigin: false,
sortable: true,
lineNumbers: true,
editable: true,
uri: "/example/data/table.json",
messagePosition: "top", // or bottom
theme: "material",
linkable: true,
links: {
wholeRow: true,
column: "",
link: "rowLink"
},
fetchOnStart: false
});theme
The theme property - The theme of this table (default is 'material')
Properties
themestring The theme of this table
linkable
The linkable property - enable links in a row (only works in non-editable tables)
Properties
linkableboolean enable/disable linking a row
links
The links property - setup linking structure for links in a row
Properties
linkableboolean enable/disable linking a row
Examples
links: {
wholeRow: false, // link whole row vs column
column: "name", // name of column
link: "rowLink" // callback or method in class
}selectable
The selectable property - enable selecting a row in table
Properties
selectableboolean enable/disable selecting a row
sortable
The sortable property - enable sorting in table
Properties
sortableboolean enable sorting in the table
sortStyle
The sortStyle property - setup the sort API
Properties
sortStylestring setup the sort API
display
Fields to display - null will display all
Properties
displayarray Fields to display
renderPaginationControl
The renderPaginationControl property - render the pagination control
Properties
renderPaginationControlboolean render the pagination control
paginationAPI
The paginationAPI property - setup the paginatin API to use
Properties
paginationAPIPaginationFactory.type the pagination API to use
description
The description property
Properties
descriptionstring The description of the table
localStorage
The localStorage property - enables localStorage
Properties
localStorageboolean The localStorage property
localStorageKey
The localStorageKey property - set the key for use in storage
Properties
localStorageKeystring The localStorage key property
editable
The editable property - enables editing of cells
Properties
editableboolean The editable property
crossOrigin
The crossOrigin property - enables cross origin fetch
Properties
crossOriginboolean The crossOrigin property
lineNumbers
The lineNumber property - turns on line numbers
Properties
lineNumbersboolean The lineNumbers property
uri
The URI property
Properties
uristring The URI property
isInitalized
The initialized property
Properties
isInitalizedboolean The initialized property
pageControlBound
The pageControlBound property
Properties
pageControlBoundboolean is the pagecontrol bound
schema
The schema property - the defining schema
Properties
schemaobject The schema
name
The name property
Properties
namestring The name of the table
setTheme
The theme of the table
Parameters
themestring name of the theme
rowLink
The default rowlink function callback called by row to format a link
Parameters
rowarray The row data
Returns string Returns the link uri
sortBy
Sort the table by a key (sent via a UI Event)
Parameters
keystring The key to sort by
currentPage
Return the current page number
Returns number The current page number
totalPages
Return the total pages
Returns number The total pages
nextPage
Advance to the next page
previousPage
Return to the previous page
goToPage
Go to a specific page
Parameters
pagenumber The page to go to
firstPage
Return to the first page
lastPage
Advance to the last page
editCell
Edit a cell at the row and column specified
Parameters
copyCell
Copy a cell at the row and column to another
Parameters
row1number The 'from' rowcol1number The 'from' columnrow2number The 'to' rowcol2number The 'to' column
clearCell
Clear a cell at the row and column specified
Parameters
render
Render the table
Returns object Returns the view context ('this')
retrieveSchema
Fetch the schema from the source URI
Parameters
uri{string} the URI to fetch from
fetch
Fetch the data from the source URI
save
Save the data to the source This only functions if the table is editable
Parameters
overrideboolean Save even if not editable
Returns any Returns true if succesfull
populate
Populate the data in the table
Parameters
sourcearray The source data array
clear
Clear all the data in the table
refresh
- *See: AutomaticTable.render *
Refresh the table (Same as render)
Returns object Returns the view context ('this')
compileTemplate
An overridable template compile
Returns string Returns the template
setURI
Sets the URI
Parameters
uristring The URI
setSchema
Sets the schema
Parameters
schemaobject The JSON schema of the dataset
showProgressBar
Enable/Disable the progress bar
Parameters
showboolean Show or Hide the progress bar
showMessage
Show a message related to the table
Parameters
messagestring Some message to display
validate
Validate the table
Returns boolean Returns true on success of validation
isValid
Is the table valid
Returns boolean Returns true if valid
remove
Remove the table and all binds
Returns any Returns the context (this)
getSelected
Gets the selected models
Parameters
jsonboolean convert to array of objects
Returns Array Returns array of selected rows (models)
getSelectedAsJSON
Gets the selected models as JSON
Returns Array Returns array of selected rows (JSON Objects)
getSelectedIndex
Gets the selected row indexes
Returns Array Returns array of selected rows (indexes)
removeRows
Removes the models
Parameters
rowsArray Models of the rows to remove
removeSelectedRows
Removes the selected models
addRow
adds a row to the table
Parameters
modelModel The model to add
exportTo
Export the table data in requested format
Parameters
typestring The type requested (csv, tsv, json, or html) html is default
Returns string The table data in requested format
BigDataTable
Extends AutomaticTable
Instance class preconfigured for sorting and pagination
Parameters
options
EditableBigDataTable
Extends AutomaticTable
Instance class preconfigured for sorting and pagination
Parameters
options
EditableLocalStorageTable
Extends AutomaticTable
Instance class preconfigured for editing, sorting, from local storage
Parameters
options
EditableTable
Extends AutomaticTable
Instance class preconfigured for editing
Parameters
options
LocalStorageTable
Extends AutomaticTable
Instance class preconfigured for local storage-based table
Parameters
options
Spreadsheet
Extends AutomaticTable
Instance class preconfigured for editing for use as a Spreadsheet.
If a propery for length is not specified, it will buffer 10 lines for editing.
Parameters
options