More in this section

Forums / General Discussions / No OrderBy on Taxa in Backend

No OrderBy on Taxa in Backend

3 posts, 1 answered
  1. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    19 Jan 2012
    Link to this post
    Hi,
    we encounter a little problem of confort on taxa. When you create or modify categories there are OrderBy [ordinal] and you can re order it if you want.
    But when you are on content editor like form to create news or event in backend, there are no order and it's more complicated to find the wanted taxa in a small box with a random order.

    There is a way to have it order ?

    Regards,
    Nicolas
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    21 Jan 2012
    Link to this post
    Hello Nicolas,

    This can be easily configured by mapping the template that's applied to the HierarchicalTaxonomySelector control used in the backend to select categories. Please follow the below instructions on how to achieve the desired functionality:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HierarchicalTaxonSelectorCustom.ascx.cs" Inherits="SitefinityWebApp.HierarchicalTaxonSelectorCustom" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
        
    <sitefinity:ResourceLinks id="resourcesLinks" runat="server">
        <sitefinity:ResourceFile Name="Styles/Treeview.css" />
        <sitefinity:ResourceFile Name="Styles/Window.css" />
    </sitefinity:ResourceLinks>
        
    <div class="sfChooseList">
        <asp:Label id="selectorTitle" runat="server"></asp:Label>
            
        <ul id="rootSelector" runat="server" class="sfRadioList">
            <li>
                <asp:RadioButton ID="rootRadio" runat="server" Checked="true" GroupName="rootSelector" />
                <asp:Label ID="rootRadioLabel" runat="server" AssociatedControlID="rootRadio"></asp:Label>
            </li>
            <li>
                <asp:RadioButton ID="taxaRadio" runat="server" GroupName="rootSelector" />
                <asp:Label ID="taxaRadioLabel" runat="server" AssociatedControlID="taxaRadio"></asp:Label>
            </li>
        </ul>
            
        <div id="treePanel" runat="server">
            <telerik:RadTreeView id="taxaTree" runat="server"
                ShowLineImages="false"
                CheckBoxes="true"
                Skin="Sitefinity"
                ExpandAnimation-Type="None"
                CollapseAnimation-Type="None" />
            <sitefinity:RadTreeBinder
                id="taxaTreeBinder"
                runat="server"
                ServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/{0}/"
                ServiceChildItemsBaseUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/subtaxa/"
                ServicePredecessorBaseUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/predecessor/"
                TargetId="taxaTree"
                ParentDataKeyName="ParentTaxonId"
                DefaultSortExpression="Title ASC"
                DataKeyNames="Id"
                DataMembers="Title"
                BindOnLoad="false">
                <Containers>
                    <sitefinity:BinderContainer ID="BinderContainer1" runat="server" RenderContainer="false">
                       <span>{{ Title }}</span>
                       <span class="sf_binderLocalization_showIfLanguageUnavailable">({$LocalizationResources, NotTranslated$})</span>
                    </sitefinity:BinderContainer>
                </Containers>
            </sitefinity:RadTreeBinder>
        </div>
        <asp:LinkButton ID="createTaxonButton" runat="server" OnClientClick="return false;" CssClass="sfCreateTaxonBtn"></asp:LinkButton>
        <asp:LinkButton ID="doneButton" runat="server" OnClientClick="return false;" CssClass="sfLinkBtn sfChange">
            <strong class="sfLinkBtnIn"><asp:Literal runat="server" ID="Literal1" Text="<%$Resources:Labels, Done %>" /></strong>
        </asp:LinkButton>
    </div>
        
    <telerik:RadWindow id="newTaxonDialog" runat="server"
            Skin="Sitefinity"
            Behaviors="Close"
            VisibleTitlebar="true"
            VisibleStatusbar="false"
            Modal="true"
            Width="485"
            ShowContentDuringLoad="false"
            Height="455">
    </telerik:RadWindow>
        
    <script type="text/javascript">
        var updateClientState = Telerik.Web.UI.RadWebControl.prototype.updateClientState;
        Telerik.Web.UI.RadTreeView.prototype.updateClientState = function () {
            updateClientState.apply(this, arguments);
            var clientStateField = $get(this.get_clientStateFieldID());
            clientStateField.value = clientStateField.value.replace(/</ig, "<");
        }
    </script>
    2. Save the template and build the project.
    3. Then go to Sitefinity backend -> Administration->Settings->Advanced->Controls->ViewMap and create a new entry there filling the boxes as follows:
    HostType: Telerik.Sitefinity.Taxonomies.Web.UI.Hierarchical.HierarchicalTaxonSelector
    TemplatePath: fill the application rleative path to the tmeplate you created (e.g. ~/HierarchicalTaxonSelectorCustom.ascx)
    4. Save the changesa nd restart your application, and you should have your classifications displayed in alaphabetic order(A-Z).

    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Nicolas
    Nicolas avatar
    156 posts
    Registered:
    19 Jan 2011
    23 Jan 2012
    Link to this post
    Thanks Boyan it works well.

    Regards
    Nicolas
3 posts, 1 answered