Hi everyone,
This is a really strange problem I'm having with component parameters and I've 
spent a whole day on this and I'm still clueless.

I have three components, a custom layout component, a menu component and a 
breadcrumb component. The menu and breadcrumb components are contained within 
the layout component. They each have a required parameter, mainMenuId and 
breadcrumbId, which is used to render the menu / breadcrumb recursively from 
the database. These parameters are bound to the containing layout component, 
and I pass them to the layout component from the page. So for example say on 
one page I only want the menu and not the breadcrumbs, i use an if in the 
layout component to check if the menuId is bound like this.<t:if 
test="mainMenuId"><t:mainMenu /></t:if>The breadcrumbs work the same way.
This works fine. Now here is where I am getting confused. In the Index page, 
I'm displaying the menu, but I'm not showing the breadcrumbs. No problem. In 
the next page, I'm just displaying the breadcrumbs without the menu. This works 
fine as well. 
But when I look at the logs when rendering the second page, I see that the 
mainMenuId getters have been called, and the database queries in the menu 
component have run, even though the menu itself is not shown in the page. I 
printed out the value and it is what I set on the index page, even though this 
page is in no way related to the index page, and this page does not provide any 
values for the mainMenuId parameter However, if I restart the server and go 
directly to the second page, then I dont see the queries and the values are not 
bound.
Here is how I'm passing the value from the Index page<div t:type="MyTheme"
 t:mainMenuId="1" >

And this is how it looks in the second page<div t:type="MyTheme" 
t:breadcrumbId="11" />
I tried clearing the values using @afterrender in the layout component, and set 
the parameters as property bindings instead of literals, with no luck. I still 
don't completely understand the page / component life cycle and so this is a 
little confusing to me. If anyone could give me any pointers I would greatly 
appreciate it.
Thanks in advance,Jeshurun


Reply via email to