Stick header on view open using _sth height param - #615
Conversation
…ktl.views.stickTableHeader
cortexrd
left a comment
There was a problem hiding this comment.
The height fix is correct — params[0][1] matches the canonical parser in stickyTableHeader(), and it fixes the previously-invalid height: undefinedpx CSS. One change requested before merge:
Add the numOfRecords gate. The normal render path skips sticky when the table is small (if (data.length < numOfRecords) return; — default 10). This path has no such gate, and since the height was previously invalid CSS, small tables were unaffected in practice. With this PR, a 3-row table inside an _hsv view will get a real 800px-tall wrapper of mostly empty space when expanded. Suggest:
const stickyHeaderParams = keywords._sth?.[0]?.params?.[0] || [];
const numOfRecords = stickyHeaderParams[0] || 10;
const viewHeight = stickyHeaderParams[1] || 800;
const rowCount = Knack.views[viewId]?.model?.data?.length || 0;
if (rowCount >= numOfRecords)
ktl.views.stickTableHeader(viewId, viewHeight);Minor (optional): since keywords._sth is now read directly, the ktl.core.checkIfViewHasKeyword(viewId, '_sth') call is redundant — if (keywords._sth) would do, keeping one source of truth.
|
Will do
…On Mon, 27 Jul 2026, 15:47 Cortex R&D Inc., ***@***.***> wrote:
***@***.**** requested changes on this pull request.
The height fix is correct — params[0][1] matches the canonical parser in
stickyTableHeader(), and it fixes the previously-invalid height:
undefinedpx CSS. One change requested before merge:
*Add the numOfRecords gate.* The normal render path skips sticky when the
table is small (if (data.length < numOfRecords) return; — default 10).
This path has no such gate, and since the height was previously invalid
CSS, small tables were unaffected in practice. With this PR, a 3-row table
inside an _hsv view will get a real 800px-tall wrapper of mostly empty
space when expanded. Suggest:
const stickyHeaderParams = keywords._sth?.[0]?.params?.[0] || [];const numOfRecords = stickyHeaderParams[0] || 10;const viewHeight = stickyHeaderParams[1] || 800;const rowCount = Knack.views[viewId]?.model?.data?.length || 0;if (rowCount >= numOfRecords)
ktl.views.stickTableHeader(viewId, viewHeight);
Minor (optional): since keywords._sth is now read directly, the ktl.core.checkIfViewHasKeyword(viewId,
'_sth') call is redundant — if (keywords._sth) would do, keeping one
source of truth.
—
Reply to this email directly, view it on GitHub
<#615?email_source=notifications&email_token=ACQQXA6NWLVOCL732N4NDYD5G5TQ7A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINZYHAZDQNZQGE42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4788287019>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQQXAZHORM3I4AFCDSXHP35G5TQ7AVCNFSNUABFKJSXA33TNF2G64TZHM2DANBXGU2DAMJRHNEXG43VMU5TIOJSHE4DIOBYG432C5QC>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
When a view with hide/show (_hsv) opens, read the height parameter from its _sth keyword and pass it to ktl.views.stickTableHeader so the sticky header uses the configured height. Add JSDoc for hideShowView to document the hide/show behavior and restoration of dependent features.