Reorder categories
Hi,
Is there a way to change the order of the categories? My customer wants to specify the order for the categories he creates.
Thanks,
Duneel
Hi Duneel,
The default filter is Ordinal
You can modify the sort expression of service by mapping Telerik.Sitefinity.Taxonomies.Web.UI.Hierarchical.HierarchicalTaxonList and setting DefaultSortExpression of ItemsTreeTable control to a property of Taxon.
You can map the type from Sitefinity/Administration/Settings/Advanced >> Controls >> ViewMap. I can attach the template of the built-in control if the above will solve your issues.
Greetings,
Ivan Dimitrov
the Telerik team
Hi Ivan,
Thanks for the quick reply.
Currenty in my webapp the categories are retrieved and listed in a custom widget. They'll appear in the same order that they returned from Sitefinity. So I want to know where there is a way to re-arrange categories from sitefinity backend like we do for pages (drag-drop to change the order).
Thanks!
Duneel
Hello Duneel,
Since you have a custom widget why don't you change the list order which will result in the control output?
Kind regards,
Ivan Dimitrov
the Telerik team
Hi Ivan,
What did you mean by "change the list order"? The logic I have implemented in my custom widget is very simple. That is to read the list of categories and show them in the same order the categories are retrieved. Now the customer wants to re-order the categories as they want. How should I give them such feature? Is this something that I will have to custom implement on the widget itself?
Thanks,
Duneel
Hello Duneel,
One of the simplest way to reorder a list of items is using
OrderBy
. If you need more complex ordering you can create a helper method that returns a list of your objects in the way you want them. In this method you need to get and return the lements of a sequence.
Greetings,
Ivan Dimitrov
the Telerik team
Hi Ivan,
Thanks for the quick response. The order for the items that the customer wants is not always assecending or descending so the order by desnt work. They are looking for something so they can order the items any way they wants. (Good example is the pages backend view, where the admin can drag-drop the pages to re-order).
Thanks,
Duneel
Hi Duneel,
You can use RadTreeView which supports Drag and Drop
demos.telerik.com/.../defaultcs.aspx
Regards,
Ivan Dimitrov
the Telerik team
Hi Ivan,
In Categories back-end list page, there is an action menu for Move Up & Move Down. What doest it do? Can I use that feature to reorder the items? Currently if click either one of them causes and error saying "Cannot move the first taxon up". See the attached error message.
Thanks,
Duneel
Hello Duneel,
You get "Cannot move first taxon up" if you click on the first item in the list. Since this is the item in the first position, there is no element above it, so you cannot move the item one level up.
In the backend we use ItemsTreeTable control.
<
sfLists:ItemsTreeTable
id
=
"hierarchicalTaxa"
runat
=
"server"
ServiceBaseUrl
=
"~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/"
ServiceChildItemsBaseUrl
=
"~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/subtaxa/"
ServicePredecessorBaseUrl
=
"~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc/predecessor/"
OnClientItemCommand
=
"itemsGrid_ItemCommand"
OnClientCommand
=
"itemsGrid_Command"
BindOnSuccess
=
"true"
ParentDataKeyName
=
"ParentTaxonId"
DataKeyNames
=
"Id"
DefaultSortExpression
=
"Ordinal"
DeleteMultipleConfirmationMessage="<%$Resources:Labels, ItemsAreAboutToBeDeleted %>"
DeleteSingleConfirmationMessage="<%$Resources:Labels, AreYouSureYouWantToDeleteItem %>"
LoadingPanelID="hierarchicalTaxaLoadingPanel"
AllowMultipleSelection="true">
<
ToolboxItems
>
<
sitefinity:CommandToolboxItem
runat
=
"server"
ContainerId
=
"toolbar"
CommandName
=
"create"
CommandType
=
"CreateButton"
WrapperTagName
=
"li"
WrapperTagCssClass
=
"sfMainAction"
/>
<
sitefinity:CommandToolboxItem
runat
=
"server"
ContainerId
=
"toolbar"
CommandName
=
"groupDelete"
Text='<%$Resources:Labels, Delete %>' WrapperTagName="li" />
<
sitefinity:MenuToolboxItem
runat
=
"server"
ContainerId
=
"toolbar"
Text='<%$Resources:Labels, Move %>' WrapperTagName="li" WrapperTagCssClass="moveMenu">
<
CommandItems
>
<
sitefinity:MenuCommandItem
runat
=
"server"
Text='<%$Resources:Labels, Up %>' CommandName="batchMoveUp" />
<
sitefinity:MenuCommandItem
runat
=
"server"
Text='<%$Resources:Labels, Down %>' CommandName="batchMoveDown" />
<
sitefinity:MenuCommandItem
runat
=
"server"
Text='<%$Resources:TaxonomyResources, ChangeParent %>' CommandName="batchChangeParent" />
</
CommandItems
>
</
sitefinity:MenuToolboxItem
>
</
ToolboxItems
>
<
Dialogs
>
<
sitefinity:DialogDefinition
OpenOnCommandName
=
"create"
Name
=
"HierarchicalTaxonForm"
CssClass
=
"sfMaximizedWindow"
/>
<
sitefinity:DialogDefinition
OpenOnCommandName
=
"edit"
Name
=
"HierarchicalTaxonForm"
CssClass
=
"sfMaximizedWindow"
Parameters
=
"?TaxonId=Id"
/>
<
sitefinity:DialogDefinition
OpenOnCommandName
=
"editTaxonomy"
Name
=
"TaxonomyForm"
CssClass
=
"sfMaximizedWindow"
/>
<
sitefinity:DialogDefinition
OpenOnCommandName
=
"changeParent"
IsModal
=
"true"
Name
=
"ChangeParentDialog"
InitialBehaviors
=
"Close"
Behaviors
=
"Close"
Skin
=
"Sitefinity"
VisibleTitlebar
=
"true"
Width
=
"425"
Height
=
"400"
/>
<
sitefinity:DialogDefinition
OpenOnCommandName
=
"permissionsForAllItems"
Name
=
"ModulePermissionsDialog"
CssClass
=
"sfMaximizedWindow"
/>
</
Dialogs
>
<
Links
>
<
sitefinity:LinkDefinition
CommandName
=
"viewItems"
/>
</
Links
>
<
Items
>
<
sfLists:ItemDescription
Name
=
"Title"
HeaderText="<%$Resources:Labels, Title %>" IsSearchField="false" DisableSorting="true" HeaderCssClass="sfTitleCol" ItemCssClass="sfTitleCol">
<
div
>
<
a
href
=
"#"
class
=
"sf_binderCommand_edit sfItemTitle"
><
strong
>Title</
strong
></
a
>
</
div
>
</
sfLists:ItemDescription
>
<
sfLists:ItemDescription
HeaderText="<%$ Resources:LocalizationResources, Translations %>" Name="Translations" IsSearchField="false" ItemCssClass="sfLanguagesCol" HeaderCssClass = "sfLanguagesCol"/>
<
sfLists:ItemDescription
Name
=
"Title"
HeaderText="<%$Resources:Labels, Actions %>" IsSearchField="false" DisableSorting="true" Width="80">
<
ul
id
=
"actions"
class
=
"actionsMenu"
>
<
li
>
<
a
menu
=
"actions"
href
=
"javascript:viod(0);"
>$Labels,Actions$</
a
>
<
ul
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_delete sfDeleteItm"
>$Labels, Delete$</
a
>
</
li
>
<%--<
li
class
=
"sfSeparator"
>
<
strong
>$Labels,CreateA$...</
strong
>
</
li
>--%>
<
li
class
=
"sfSeparator"
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_createChild sfCreateChild"
>$TaxonomyResources,ChildCategory$</
a
>
</
li
>
<%--<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_createSiblingBefore"
">$TaxonomyResources,SiblingCategoryBefore$</
a
>
</
li
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_createSiblingAfter"
>$TaxonomyResources,SiblingCategoryAfter$</
a
>
</
li
>--%>
<
li
class
=
"sfSeparator"
>
<
strong
>$Labels,Move$...</
strong
>
</
li
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_moveUp sfMoveUp"
>$Labels,Up$</
a
>
</
li
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_moveDown sfMoveDown"
>$Labels,Down$</
a
>
</
li
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_changeParent"
>$TaxonomyResources,ChangeParent$</
a
>
</
li
>
<
li
class
=
"sfSeparator"
>
<
strong
>$Labels,Edit$...</
strong
>
</
li
>
<
li
>
<
a
sys:href
=
"#"
class
=
"sf_binderCommand_edit"
>$Labels,Properties$</
a
>
</
li
>
</
ul
>
</
li
>
</
ul
>
</
sfLists:ItemDescription
>
<
sfLists:ItemDescription
Name
=
"UrlName"
HeaderText="<%$Resources:Labels, Url %>" IsSearchField="false" DisableSorting="true" Width="150" HeaderCssClass="sfUrl" ItemCssClass="sfUrl">
<
div
>UrlName </
div
>
</
sfLists:ItemDescription
>
<
sfLists:ItemDescription
Name
=
"AppliedTo"
HeaderText="<%$Resources:Labels, AppliedTo %>" IsSearchField="false" DisableSorting="true" Width="100" HeaderCssClass="sfNumeric" ItemCssClass="sfNumeric">
<
div
>
<
a
class
=
"sf_binderCommand_viewItems"
href
=
"#"
>ItemsCount $Labels, Items$</
a
>
</
div
>
</
sfLists:ItemDescription
>
</
Items
>
</
sfLists:ItemsTreeTable
>
Hi Ivan, Even if I select an item in the middle and try to move, I still get the same error. I believe it is a bug in Sitefinity. Can you please confirm? Thanks, Duneel
Hi Duneel,
I cannot replicate this issue with the latest official version. If you are using it, please provide some detailed steps that we can follow to try to replicate this issue and confirm whether it is a bug or not.
Regards,
Ivan Dimitrov
the Telerik team
Here are the steps to reproduce the issue.
Create a Category
And create few other categories within the first category.
Now try to move the dhild categories up and down.
Thanks,
Duneel
Hello Duneel,
I am not able to replicate this issue with the latest official release.
All the best,
Ivan Dimitrov
the Telerik team
Hi Ivan,
Ours is not a fresh site built on the latest SF 4 build. It was originally 4.0 and then updated everytime a new build was out and now it's the latest build. Could that be the problem? How should we go about this?
We are using version 4.1.1501. I tried the same on a fresh website created on the latest build and it's working fine there. So I suspect that something is wrong when the site was originally built in 4.0 and then updated to the latest version.
Thanks,
Duneel
Hi Duneel,
I will be glad to assist in solving your problem. Is it possible for you to send us your copy of your website and database so I can restore it locally and reproduce and debug the issue. Since there are many upgrades of the site I am not sure that my attempt to follow what you did will give the same result.
Greetings,
GeorgePPetrov
the Telerik team
Hi,
How do I sort the categories in the blogs, News section to be by name. Currently I donot know in which order it is being displayed.
Thanks
Madhavan
Hello Madhavan,
The problem is that we do not pass sort expression to the HierarchicalTaxon service and the taxon items are not retrieves in the correct list order. I logged a pits issue about this issue that you can follow
Public Url: http://www.telerik.com/support/pits.aspx#/public/sitefinity/6952
Best wishes,
Ivan Dimitrov
the Telerik team
Hi George,
I was able to figure out wats going on and the issue was now fixed. I looked in the database and for some reason all the categories had the same value ("3") for the ordinal. That may be because the database was initially created for 4.0 and then upgraded. So I manually adjusted the ordinal field to have different values.
Thanks,
Duneel