Match the grand-total row by its TOTAL label
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9db2b59ab
commit
061fc9fff4
@ -1237,16 +1237,19 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
|
|||||||
table.addStyleListener(() => {
|
table.addStyleListener(() => {
|
||||||
// The grand-total row, hidden on request. The engine has no rollup mode
|
// The grand-total row, hidden on request. The engine has no rollup mode
|
||||||
// for "subtotals but no grand total" -- rollup, flat and total are the
|
// for "subtotals but no grand total" -- rollup, flat and total are the
|
||||||
// three -- so it is dropped here instead. It is view row 0 with a row
|
// three -- so it is dropped here instead. It is view row 0, whose row
|
||||||
// header blank at every level; y alone is not enough, since under flat
|
// header the datagrid fills with a label object reading "TOTAL" and
|
||||||
// rollup there is no total and row 0 is a leaf. Tagged per draw, because
|
// blanks below it -- not blank throughout, which is what this first
|
||||||
// the grid recycles its tr elements as it scrolls.
|
// assumed. y alone is not enough, since under flat rollup there is no
|
||||||
|
// total and row 0 is a leaf. Tagged per draw, because the grid recycles
|
||||||
|
// its tr elements as it scrolls.
|
||||||
for (const tr of table.querySelectorAll('tbody tr')) {
|
for (const tr of table.querySelectorAll('tbody tr')) {
|
||||||
const th = tr.querySelector('th')
|
const th = tr.querySelector('th')
|
||||||
let meta
|
let meta
|
||||||
try { meta = th ? table.getMeta(th) : null } catch { meta = null }
|
try { meta = th ? table.getMeta(th) : null } catch { meta = null }
|
||||||
const isTotal = meta?.y === 0 && Array.isArray(meta.row_header) &&
|
const head = meta?.row_header
|
||||||
!meta.row_header.some(notBlank)
|
const isTotal = meta?.y === 0 && Array.isArray(head) &&
|
||||||
|
String(head[0]) === 'TOTAL' && !head.slice(1).some(notBlank)
|
||||||
tr.classList.toggle('pf-total-row', isTotal && !showTotalRowRef.current)
|
tr.classList.toggle('pf-total-row', isTotal && !showTotalRowRef.current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user