Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Categories navigation making page reload (7.2 CE GA2)
Hi guys,
Using the categories navigation to control an asset publisher seems to reload the page (even without disabling the SPA). This is normally not a problem but this time I have a long page with a categories navigation controlling an asset publisher near the end of the page. The problem is that, when the user clicks on the category, the browser goes back to the top of the page and the portlets are no longer visible, forcing the user to scroll down again to the bottom of the page.
Is there any way to disable this behaviour? Making asset publisher load by ajax, for example?
TIA
Fernando
Using the categories navigation to control an asset publisher seems to reload the page (even without disabling the SPA). This is normally not a problem but this time I have a long page with a categories navigation controlling an asset publisher near the end of the page. The problem is that, when the user clicks on the category, the browser goes back to the top of the page and the portlets are no longer visible, forcing the user to scroll down again to the bottom of the page.
Is there any way to disable this behaviour? Making asset publisher load by ajax, for example?
TIA
Fernando
Hola Fernando,
You could use a ADT for the categorynavigation where you add a #[thepartofthepagetogoto] to the link indicating that page with <a name='thepartofthepagetogoto'> </a> (or the HTML5 way) because what the categorynavigation does is simply calling the same page with a categoryid in the url.
This is what your ADT template could look like ...
<#if entries?has_content>
<ul>
<#list entries as curVocabulary>
<li>
${curVocabulary.name}
<ul>
<#list curVocabulary.getCategories() as category>
<li><a href='?p_r_p_categoryId=${category.categoryId}#endofthepage' >${category.name}</a></li>
</#list>
</ul>
</li>
</#list>
</ul>
</#if>
You could use a ADT for the categorynavigation where you add a #[thepartofthepagetogoto] to the link indicating that page with <a name='thepartofthepagetogoto'> </a> (or the HTML5 way) because what the categorynavigation does is simply calling the same page with a categoryid in the url.
This is what your ADT template could look like ...
<#if entries?has_content>
<ul>
<#list entries as curVocabulary>
<li>
${curVocabulary.name}
<ul>
<#list curVocabulary.getCategories() as category>
<li><a href='?p_r_p_categoryId=${category.categoryId}#endofthepage' >${category.name}</a></li>
</#list>
</ul>
</li>
</#list>
</ul>
</#if>
Hi Jan,
Please correct me if I'm wrong but the problem with that approach, I believe, is that the asset publisher will not render a new list based on that category.
Fernando
Please correct me if I'm wrong but the problem with that approach, I believe, is that the asset publisher will not render a new list based on that category.
Fernando