Sorting Arrays by Properties in the Template Editor for Visualizers

Overview

Originally, the arrays in the template editor for visualizers are sorted alphabetically. This article shares the process of sorting them by properties.


 

Process

  1. Log into your DNN instance.
  2. Go to Content > Content Library > Visualizers > Choose a Visualizer.
  3. Open the Editor tab.
  4. Modify the following sample code as needed. In this example, the code assigns the storeLocations property to the locations variable and sorts by the contentName property.

    {% assign locations = storeLocations | sort: 'contentName' -%}
    {% for item in locations -%}
    <div class="storeLoc">
    {{item.contentName}}
    </div>
    {% endfor -%}
  5. Place the code in the Template section and save.

Comments

0 comments

Please sign in to leave a comment.