About Handlebars partials in SQLPage #1222
-
|
For below scenario, I am getting error like Helper each_row not found. As per SQLPage documentation, each_row helper is available. Any guidence on what is missing? Is it because shell-empty component? /sqlpage/templates/nested_element.handlebars index.sql select 'shell-empty' as component
, 'htmx.js' as javascript
;
SELECT
'nested_element' as component,
'div' as tagName,
-- 'card-outer' as class,
'Parent' as contents,
jsonb_build_array(
jsonb_build_object(
'nested_element','component'
,'tagName', 'div'
, 'contents', 'Child Level 1',
'sub_components', jsonb_build_array(
jsonb_build_object(
'nested_element','component'
,'tagName', 'div'
,'contents', 'Child Level 2'
)
)
)
) as sub_components;getting error like below Error in query number 1 Error rendering "SQLPage component before each block" line 22, col 9: Helper not found each_row |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
And the rows it renders need to be passed as row-level parameters. See https://sql-page.com/documentation And referencing other components (or the same component) inside handlebars partials is not supported. The html structure of your application needs to be declared explicitly and statically in your handlebar components, not in your sql. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.

This issue is solved using "inline partials" in Handlebars. Now SQLPage can be like HTML unlimted nesting. One compnent can embed another component. Below one is a htmx powered universal component!