feat(sql_console): make columns resizable

This commit is contained in:
Elian Doran 2026-01-17 21:45:10 +02:00
parent c6896a4b33
commit 769f3db21c
No known key found for this signature in database

View File

@ -2,6 +2,7 @@ import "./SqlConsole.css";
import { SqlExecuteResults } from "@triliumnext/commons"; import { SqlExecuteResults } from "@triliumnext/commons";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import { ResizeColumnsModule } from "tabulator-tables";
import { t } from "../../services/i18n"; import { t } from "../../services/i18n";
import Tabulator from "../collections/table/tabulator"; import Tabulator from "../collections/table/tabulator";
@ -60,13 +61,15 @@ function SqlResultTable({ rows }: { rows: object[] }) {
return ( return (
<Tabulator <Tabulator
layout="fitDataFill" layout="fitDataFill"
modules={[ ResizeColumnsModule ]}
columns={[ columns={[
...Object.keys(rows[0]).map(key => ({ ...Object.keys(rows[0]).map(key => ({
title: key, title: key,
field: key, field: key,
width: 250,
minWidth: 100, minWidth: 100,
maxWidth: 400, widthGrow: 1,
widthGrow: 1 resizable: true
})) }))
]} ]}
data={rows} data={rows}