Re: exec/load/table.js
By: Kirkman to echicken on Wed Oct 03 2018 19:56:06
Interesting... Can't wait to check that out! Sounds like something I might want to switch to in my Sports Stats code.
Pretty simple to use:
load('table.js');
var data = [['the','heading','row'],['the','next','row']]; // and so on
// data, line colour, heading colour, cell colour, width
var t = table(data, '\1h\1c', '\1h\1w', '\1n\1w', 79);
console.putmsg(t);
All arguments except 'data' are optional.
You can do column-spanning cells by leaving the next cell to the right empty:
var data = [['a cell','a colspan cell','']];
Or row-spanning cells with ':::' in the cells to span:
var data = [['this cell spans three rows'],[':::'],[':::']];
And combinations of the above. Cell content wrapping for column spanning cells is still a to-do item. Wrapping within normal cells works.
wiki-markup.js is worth taking a peek at as well, since table.js was created in support of it. Handles most of the DokuWiki markup syntax, and renders to HTML, console, or Frame. May be useful at some point. (Use the same routine in a script to generate markup whether for the console or for the web, then just render it for the appropriate view.)
---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com