@dojo-ng/data-grid-export
v0.1.0
Published
CSV export for @dojo-ng/data-grid
Readme
@dojo-ng/data-grid-export
CSV export for @dojo-ng/data-grid
Part of Dojo NG, a framework-agnostic web component library. BSD-3-Clause.
Exports RAW cell values (formatting is presentation). Default set = filtered but unpaginated rows;
all: trueexports the pre-filter set. Synthetic__columns (like the detail expander) are skipped.
Install
npm install @dojo-ng/data-grid-exportUsage
The chrome button downloads the current (filtered, unpaginated) rows. Import toCsv/downloadCsv and pass the grid element to build your own button.
<dj-data-grid id="g"></dj-data-grid>
<script type="module">
import "@dojo-ng/data-grid";
import { exportPlugin, toCsv } from "@dojo-ng/data-grid-export";
const g = document.getElementById("g");
g.columns = [{ id: "name", header: "Name" }];
g.data = [{ name: "Widget" }, { name: "Gadget" }];
g.plugins = [exportPlugin({ filename: "inventory.csv" })];
// or, from your own UI: console.log(toCsv(g));
</script>