Search

Contents

Revindex Storefront

Export Print

How to expand all categories

The latest Revindex Storefront uses a Telerik RadTreeView control to render the categories. To expand all the categories, you can create a custom display template and add a OnClientLoad event with some javascript.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Display.ascx.cs" Inherits="Revindex.Dnn.RevindexStorefront.Portals._default.Display.Category.Standard3.Display" %>
<%@ Register Assembly="DotNetNuke.Web.Deprecated" Namespace="DotNetNuke.Web.UI.WebControls" TagPrefix="dnn2" %>

<div class="rvdsfCategoryContainer">
  <dnn2:DnnTreeView ID="CategoryDnnTreeView" runat="server" ShowLineImages="false" CssClass="rvdsfCategoryTreeView" Skin="" OnClientLoad="CategoryDnnTreeView_Loaded">
    <NodeTemplate>
      <a href='<%# DataBinder.Eval(Container, "NavigateUrl") %>'>
        <%# DataBinder.Eval(Container, "Text") %></a>
    </NodeTemplate>
  </dnn2:DnnTreeView>
</div>

<script type="text/javascript">
function CategoryDnnTreeView_Loaded(treeView, args)
{
  var nodes = treeView.get_allNodes();
  for (var i = 0; i < nodes.length; i++)
  {
    if (nodes[i].get_nodes() != null)
      nodes[i].expand();
  }
}
</script>

Comments

Add comment
Woody May 04, 2016 7:29 PM
In the example above you need to change the Assembly reference

Assembly="DotNetNuke.Web.Deprecated"
Stephen L May 06, 2016 5:07 AM
Good catch. It's corrected now. Thanks!
Elizabeth Senger Jan 23, 2017 11:27 PM
Would it be possible to have the template focus on just one top-level node of the category tree?
Stephen L Jan 24, 2017 8:45 PM
Yes, the next version of Storefront v11 coming out in a few week will be based on Razor templates and will have a choice to show in tree view or single level list.

Powered by Revindex Wiki