No OrderBy on Taxa in Backend
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
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>
Thanks Boyan it works well.
Regards
Nicolas