Published
Edited
Feb 12, 2022
2 stars
Also listed in…
Tips and Utilities
Insert cell
Insert cell
Insert cell
TinyBase = require('tinybase@1.1.0/lib/umd/store.js')
Insert cell
store = {
const store = TinyBase.createStore();
store.setCell('t1', 'r1', 'c1', 'Hello World');

store.setTable('pets', {fido: {species: 'dog'}})
.setCell('pets', 'fido', 'color', 'brown')
.setCell('pets','poochy', 'species', 'mut');
yield store
}
Insert cell
output = html`
<div>
${store.getCell('t1', 'r1', 'c1')}
</div>
`
Insert cell
{
store
}
Insert cell
query = store.getRow('pets', 'fido')
Insert cell
viewof table = Inputs.table([query], {})
Insert cell
petsTable = store.getTable('pets')
Insert cell
Insert cell
viewof button = Inputs.button("Click me", {
reduce: () => {
store.forEachRow('pets',(rowId, forEachCell ) => {
console.log('rowId', rowId);
forEachCell((cellId)=> {
mutable results += `<div>[row: ${rowId} --> ${cellId}]</div>`
console.log(cellId)
});
});
}});

Insert cell
mutable results = `res`
Insert cell
html`${
results
}`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more