Re: Calling #Macro Recursively

firoza <[email protected]> Thu, 23 Oct 2014 10:43:00 -0700 (PDT)
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi Deniel,
I tried for recursive call but its not working it's giving errors at
runtime.

Below is what i want to achieve:
I have a Java Bean (pojo) with followin fields with getter and setter
methods.

The pojos are populated with data using the recursive function of java. 

I have productSearchResultList bject which is the list of type
HierarchyProductSearchResult(which is populated as metioned above).
Now I want to display this list in ftl 

The format is :
//Iterate the productSearchResultList and if the recods has children then
open the new ul and display all its children in li.. This will go till n
level
<ul>
<li>


	//this entry has children
	<ul>
		<li>
			<ul>
			<li></li>
			</ul>
		</li>	
		<li></li>
		<li></li>
	</ul>
</li>

<li></li>
...
</ul>

In each <li> I need to dispaly the infomation in a table something like this


	
${productresult.chpd}
	
${productresult.conf}
	
${productresult.conf}



The code in FTL:

<div class="col-results">					
							
							 <#macro hierarchy searchResultList>
							<ul>
							<#list searchResultList as productresult>
							
							<#assign detailViewPopUp="Y">
								<li>									
									
									
										<#if productresult.hierarchy.children?has_content>
											 <@liferay_ui.message key="resultview.hierarchy.click"/>
<JavaScript:void(0);>  
										
										</#if>
									
									
									

										
${productresult.chpd}
										
${productresult.conf}
										........
									


									
									
									<#if productresult.hierarchy.children?has_content>
											
									
											 <@hierarchy searchResultList=productresult.hierarchy.children/>
											
												
									</#if>								
								
								</li>
								
							</#list>
							</ul>
							</#macro>

<@hierarchy searchResultList=productSearchResultList/>
		
</div>


Please let me know where I am making the mistake. I got stuck in this.

Thanks,
Firoza



--
View this message in context: http://freemarker.624813.n4.nabble.com/Calling-Macro-Recursively-tp626735p4655304.html
Sent from the freemarker-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------