Skip to content

Commit dade007

Browse files
show all data rows (#12)
1 parent 2d6b67f commit dade007

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/client/render.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export function render({container, mime, value}: IRenderInfo) {
1313
const table = inputs.table(data, {
1414
layout: 'auto',
1515
width: 'auto',
16-
height: 360
16+
height: 360,
17+
rows: lengthOf(data)
1718
});
1819
console.log(`data.table: mime-type=${mime}`);
1920
container.appendChild(table);
@@ -24,3 +25,23 @@ if (module.hot) {
2425
// TODO: dispose resources and save renderer state
2526
});
2627
}
28+
29+
30+
function lengthOf(data: any) {
31+
if (typeof data.length === 'number') {
32+
// array or array-like
33+
return data.length;
34+
}
35+
36+
if (typeof data.size === 'number') {
37+
// map or set
38+
return data.size;
39+
}
40+
41+
if (typeof data.numRows === 'function') {
42+
// arquero
43+
return data.numRows();
44+
}
45+
46+
return 0;
47+
}

src/client/style.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
.data-table {
2-
font-family: Menlo, Monaco, "Courier New", monospace;
3-
max-height: 20em;
42
max-width: 100%;
53
overflow-y: scroll;
64
}

0 commit comments

Comments
 (0)