Skip to content

Using lists as component parameters (to generate a dynamic navigation menu) #55

Answered by lovasoa
gourk asked this question in Q&A
Discussion options

You must be logged in to vote

What you are trying to do is definitely possible !

Excuse me for the long answer, but I will try to make it as generally useful to others as possible.

There are two points in your question:

  • How to pass a list as a parameter to a component ?
  • How to use the list from your custom component template ?

How to pass a list as a parameter to a component ?

  • The first solution is to return multiple columns with the same name from your query.
    • SELECT 1 AS x, 2 AS x will pass { "x": [1,2] } to your template
    • This works well when the number of items in the array does not depend on the database; when it is fixed and known in advance.
    • That is not what you need in your case, because it looks like you ha…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@lovasoa
Comment options

@gourk
Comment options

@lovasoa
Comment options

Answer selected by gourk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants