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: 1 comment
-
|
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.
each_rowneeds to be at the top level of the template, not inside an if.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.