web-table

Published on webcomponents.org

Web Table

Converts data to a html table. It is

DEMO:

CDN

<script src="https://cdn.jsdelivr.net/gh/alan-khosro/web-table/dist/web-table.min.js" type="module"></script>

Simple Usage

Import library and initiate the table with a data url to populate it

<script src="../dist/web-table.js" type="module"></script>

<web-table 
	url="./cash_flow_components.json" 
	datatype="records"
></web-table>

User can use its built-in Settings ui to tweak irs colors, data source, etc.

options

you can pass optional attributes:

<script src="../dist/web-table.min.js" type="module"></script>

<web-table 
	url="./owid-covid-latest.csv" 
	datatype="csv"
	delim=","
	accent="255, 100, 100",
	columns="location,total_cases_per_million,new_cases_smoothed,total_deaths_per_million,new_deaths_smoothed"
	renames="loc,case_rate,new_cases,deaths_rate,new_deaths"
></web-table>

Advanced Usage

You can initiate it with no data url and then call its populate method in your js file. It is useful for advanced use case when you need to prepare your data before populating the table.

Please notice that the webcomponent has no url when you are populating data through js Please notice the second variable is an object that defines the options

<simple-table></simple-table>

TODO features: YAGNI

Technical Debt: