No OrderBy on Taxa in Backend

Posted by Community Admin on 03-Aug-2018 09:41

No OrderBy on Taxa in Backend

All Replies

Posted by Community Admin on 19-Jan-2012 00:00

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

Posted by Community Admin on 21-Jan-2012 00:00

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

Posted by Community Admin on 23-Jan-2012 00:00

Thanks Boyan it works well.

Regards
Nicolas

This thread is closed