fix(print/table): missing title

This commit is contained in:
Elian Doran 2025-11-21 22:12:05 +02:00
parent 749740242e
commit c43820776f
No known key found for this signature in database

View File

@ -12,31 +12,36 @@ export default function TablePrintView({ note, noteIds, viewConfig }: ViewModePr
const [ html, setHtml ] = useState<string>(); const [ html, setHtml ] = useState<string>();
return rowData && ( return rowData && (
<div className="table-print-view"> <>
{!html ? ( <h1>{note.title}</h1>
<Tabulator
tabulatorRef={tabulatorRef} <div className="table-print-view">
className="table-print-view-container"
modules={[ PrintModule, ExportModule, FormatModule ]} {!html ? (
columns={columnDefs ?? []} <Tabulator
data={rowData} tabulatorRef={tabulatorRef}
index="branchId" className="table-print-view-container"
dataTree={hasChildren} modules={[ PrintModule, ExportModule, FormatModule ]}
printStyled={true} columns={columnDefs ?? []}
onReady={() => { data={rowData}
const tabulator = tabulatorRef.current; index="branchId"
if (!tabulator) return; dataTree={hasChildren}
const generatedTable = tabulator.modules.export.generateTable(tabulator.options.printConfig, tabulator.options.printStyled, tabulator.options.printRowRange, "print"); printStyled={true}
if(tabulator.options.printFormatter){ onReady={() => {
tabulator.options.printFormatter(tabulator.element, generatedTable); const tabulator = tabulatorRef.current;
} if (!tabulator) return;
setHtml(generatedTable.outerHTML); const generatedTable = tabulator.modules.export.generateTable(tabulator.options.printConfig, tabulator.options.printStyled, tabulator.options.printRowRange, "print");
}} if(tabulator.options.printFormatter){
/> tabulator.options.printFormatter(tabulator.element, generatedTable);
) : ( }
<RawHtmlBlock html={html} className="tabulator-print-fullscreen" /> setHtml(generatedTable.outerHTML);
)} }}
</div> />
) : (
<RawHtmlBlock html={html} />
)}
</div>
</>
) )
} }