Skip to content
Discussion options

You must be logged in to vote

dv.table() takes in an array of arrays, and formats it as a table. It does not support rendering maps, though you can convert a map to an array without too much trouble.

If your input is an array of maps, like this:

const results = [
  {name: "abc", height: "3", diameter: "2"},
  {name: "efg", height: "7", diameter: "4"},
];

dv.table(["name", "height", "diameter"], results.map(r => [r.name, r.height, r.diameter]));

This is the standard usage of dv.table (array of maps, which is the same as an array of pages since pages are maps). If you have a map of maps as your last example, you'll need to go through one more level of mapping:

const map = new Map([
	[0, { name: "hello" }],
	[1, { name: "…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@flatlines
Comment options

Comment options

You must be logged in to vote
2 replies
@flatlines
Comment options

@AB1908
Comment options

Answer selected by flatlines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants