Demo row numbers

This commit is contained in:
Kenny Daniel 2024-06-13 23:49:03 -07:00
parent 9ab5004cd8
commit 54934d916c
No known key found for this signature in database
GPG Key ID: 90AB653A8CAD7E45
3 changed files with 22 additions and 1 deletions

@ -16,6 +16,8 @@ nav {
overflow-x: hidden;
overflow-y: auto;
padding: 10px;
min-width: 0;
max-width: 40%;
width: 320px;
}
h1 {
@ -26,7 +28,6 @@ h2 {
}
p {
margin: 10px 0;
width: 300px;
}
.error {
color: #c11;
@ -131,6 +132,21 @@ th, td {
overflow: hidden;
white-space: pre-wrap;
}
/* row numbers */
td:first-child {
background-color: #eaeaeb;
border-right: 1px solid #ddd;
color: #888;
font-size: 10px;
padding: 0 2px;
position: sticky;
left: 0;
text-align: center;
user-select: none;
min-width: 32px;
max-width: none;
width: 32px;
}
#filename {
font-size: 10pt;

@ -179,6 +179,7 @@ function renderTable(header, data) {
const thead = document.createElement('thead')
const tbody = document.createElement('tbody')
const headerRow = document.createElement('tr')
headerRow.appendChild(document.createElement('th'))
for (const columnName of header) {
const th = document.createElement('th')
th.innerText = columnName
@ -188,6 +189,9 @@ function renderTable(header, data) {
table.appendChild(thead)
for (const row of data) {
const tr = document.createElement('tr')
const rowNumber = document.createElement('td')
rowNumber.innerText = String(tbody.children.length + 1)
tr.appendChild(rowNumber)
for (const value of Object.values(row)) {
const td = document.createElement('td')
td.innerText = stringify(value)

@ -5,6 +5,7 @@
<title>hyparquet parquet file parser</title>
<link rel="stylesheet" href="demo/demo.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Mulish:wght@400;600&display=swap"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="dropzone">