Skip to content
This repository has been archived by the owner on Dec 14, 2024. It is now read-only.

Commit

Permalink
hm
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Dec 4, 2024
1 parent 496447e commit 4e81e7c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './style.css'
import "gridjs/dist/theme/mermaid.css";
import { Grid } from "gridjs";
import Vortex, { vortexLoad } from "a10y-vortex";
import { TColumn } from "gridjs/dist/src/types";

document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
<div>
Expand Down Expand Up @@ -50,24 +51,34 @@ vortexLoad().then(() => {

console.log("using data", sliced.to_js());

const columns: [TColumn] = [];
for (let i = 0; i < sliced.columns().length; i++) {
const name = sliced.columns()[i];
const dtype = sliced.types()[i];
columns.push({
id: sliced.columns()[i],
name: `${name} (${dtype})`,
});
}

if (grid != undefined) {
grid.updateConfig({
resizable: true,
columns: sliced.columns(),
columns: columns,
data: sliced.to_js(),
pagination: {
limit: 20,
}
},
});
grid.forceRender();
} else {
grid = new Grid({
resizable: true,
columns: sliced.columns(),
columns: columns,
data: sliced.to_js(),
pagination: {
limit: 20,
}
},
}).render(gridElem);
}
}
Expand Down

0 comments on commit 4e81e7c

Please sign in to comment.