presentation-table
v3.5.5
Published
The Augmented.js Next - Presentation Table View Module.
Downloads
10
Maintainers
Readme
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
theme
string The theme of this table
linkable
The linkable property - enable links in a row (only works in non-editable tables)
Properties
linkable
boolean enable/disable linking a row
links
The links property - setup linking structure for links in a row
Properties
linkable
boolean 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
selectable
boolean enable/disable selecting a row
sortable
The sortable property - enable sorting in table
Properties
sortable
boolean enable sorting in the table
sortStyle
The sortStyle property - setup the sort API
Properties
sortStyle
string setup the sort API
display
Fields to display - null will display all
Properties
display
array Fields to display
renderPaginationControl
The renderPaginationControl property - render the pagination control
Properties
renderPaginationControl
boolean render the pagination control
paginationAPI
The paginationAPI property - setup the paginatin API to use
Properties
paginationAPI
PaginationFactory.type the pagination API to use
description
The description property
Properties
description
string The description of the table
localStorage
The localStorage property - enables localStorage
Properties
localStorage
boolean The localStorage property
localStorageKey
The localStorageKey property - set the key for use in storage
Properties
localStorageKey
string The localStorage key property
editable
The editable property - enables editing of cells
Properties
editable
boolean The editable property
crossOrigin
The crossOrigin property - enables cross origin fetch
Properties
crossOrigin
boolean The crossOrigin property
lineNumbers
The lineNumber property - turns on line numbers
Properties
lineNumbers
boolean The lineNumbers property
uri
The URI property
Properties
uri
string The URI property
isInitalized
The initialized property
Properties
isInitalized
boolean The initialized property
pageControlBound
The pageControlBound property
Properties
pageControlBound
boolean is the pagecontrol bound
schema
The schema property - the defining schema
Properties
schema
object The schema
name
The name property
Properties
name
string The name of the table
setTheme
The theme of the table
Parameters
theme
string name of the theme
rowLink
The default rowlink function callback called by row to format a link
Parameters
row
array The row data
Returns string Returns the link uri
sortBy
Sort the table by a key (sent via a UI Event)
Parameters
key
string 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
page
number 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
row1
number The 'from' rowcol1
number The 'from' columnrow2
number The 'to' rowcol2
number 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
override
boolean Save even if not editable
Returns any Returns true if succesfull
populate
Populate the data in the table
Parameters
source
array 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
uri
string The URI
setSchema
Sets the schema
Parameters
schema
object The JSON schema of the dataset
showProgressBar
Enable/Disable the progress bar
Parameters
show
boolean Show or Hide the progress bar
showMessage
Show a message related to the table
Parameters
message
string 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
json
boolean 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
rows
Array Models of the rows to remove
removeSelectedRows
Removes the selected models
addRow
adds a row to the table
Parameters
model
Model The model to add
exportTo
Export the table data in requested format
Parameters
type
string 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