Public
Edited
Feb 20, 2023
1 fork
Insert cell
Insert cell
Insert cell
viewof table = {
const node = htl.html`<div style="height:320px;" class="ag-theme-alpine"></div>`;
new AgGrid.Grid(node, gridOptions);
gridOptions.api.addEventListener("modelUpdated", update) // set value after filter
gridOptions.api.sizeColumnsToFit();
update(); // set initial value

function update() { // for Observable dataflow
let value = [];
gridOptions.api.forEachNodeAfterFilter(d => value.push(d.data));
node.value = value;
node.dispatchEvent(new Event("input"));
}
return node;
}
Insert cell
gridOptions = ({
columnDefs: [
{ field: "col1", filter: true, enableRowGroup: true, rowGroup: true, hide: true },
{ field: "col2", filter: true },
],
rowData: post_aq_dat,
rowSelection: "single"
})
Insert cell
AgGrid = require('ag-grid-enterprise@23.0.2/dist/ag-grid-enterprise.js')
Insert cell
dat = d3.csvParse(`col1,col2
a,1
a,2
b,3`, d3.autoType)
Insert cell
aq_dat = aq.from(dat)
.filter(aq.escape(d => d.col2 <= filter_col2))
Insert cell
post_aq_dat = aq_dat.objects()
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