Forum Discussion
It appears this only works on simply types such as strings and numbers. Is it possible to pass a list of messages?
Thanks again,
Scott
Hi Scott,
Sorry for the late follow up. I was forwarded to your post by someone else that had the same question. I figured I'd reply here for the benefit of others.
If you’re adding the component to a page via the page editor in Studio, then I believe you’re fairly restricted in what types of values you can use… pretty much just strings as you discovered.
If you’re adding the component to another component via the <@component> macro, then you have a bit more flexibility. With the macro, you can pass other types and objects as well. For example:
<#assign community=rest("/").community /> <@component id="paramtest" param=community />
Then in your paramtest component, you could do something like:
${env.context.component.getParameter('param').id}
to give you the id of the community.
Here's a better example more a long the lines of what you were talking about. This example shows passing some threads:
<#assign threads=rest("/threads/recent").threads /> <@component id="paramtest" param=threads />
Then in your paramtest component:
<#assign threads=env.context.component.getParameter('param') /> <#list threads.thread as thread> ${thread.messages.topic.subject}<br/> </#list>
- Henrik12 years agoAdvisor
Hi,
Is it possible to pass an array as a parameter? I've made some tests but couldn't manage to make it work.
For instance, I'd like to pass a thread list built from two boards:
<#assign topics1 = rest("/boards/id/ID1/topics/recent").messages /> <#assign topics2 = rest("/boards/id/ID2/topics/recent").messages /> <#assign topics = [topics1,topics2] /> <@component id="paramtest" param=topics />
Or is it possible to make a single objet from topics1 and topics2?
Thanks!
Henrik
- KPNOnline10 years agoMentor
I am curious about the same, because I cannot get it to work..
I want to pass a custom object to a child component, but cannot get it to work..
Is there any real life example that is not based on R.E.S.T. return datas?
- nibo10 years agoMentor
Hey Adam,
do you know, if it is possible to pass a boolean as a parameter? It tried it, but it is not working, so I'm currently passing a "true" or "false" as a string.
Thanks
Nikolay
- Inactive User8 years agoAdamN Any feedback on this?