[英]CustomSortOrder for Taxonomy Term (Sharepoint 2010)
I'm trying to set a custom order for my term set "Cities" using the Term store management tool. 我正在尝试使用术语库管理工具为术语集“城市”设置自定义订单。
When the user creates a new content type which has the column "City", the cities from the term store are displayed in the correct order. 当用户创建具有“城市”列的新内容类型时,术语库中的城市将以正确的顺序显示。 But when I'm looking at the term store from code, the order is not correct at all.
但是,当我从代码中查看术语存储时,顺序根本不正确。 To get the term set I'm using this:
为了获得术语集,我使用了这个:
TermCollection myTermCollection = term.Groups[taxonomyGroupName].TermSets[taxonomyListName].GetAllTerms();
The default order in the 'myTermCollection' is the creation order of the taxonomies. “ myTermCollection”中的默认顺序是分类法的创建顺序。 The order listed in the property "CustomSortOrder" is alphabeticall.
属性“ CustomSortOrder”中列出的顺序为字母顺序。 None of them are the correct one set using the term store management tool.
使用术语商店管理工具,它们都不是正确的一套。
I ran manually the Taxonomy Update Scheduler, and the job works fine since I saw taxonomy names being updated correctly after running this, but the order is still not right. 我手动运行了分类法更新调度程序,该工作正常运行,因为运行此程序后我看到分类法名称已正确更新,但是顺序仍然不正确。
Any ideas are very much appreciated! 任何想法都非常感谢!
It was so simple! 太简单了!
In order to get the custom order, I was doing: 为了获得自定义订单,我正在做:
TermCollection myTermCollection = term.Groups[taxonomyGroupName].TermSets[taxonomyListName].GetAllTerms();
orderList = myTermCollection[0].CustomSortOrder;
Instead, I had to do 相反,我不得不
TermCollection myTermCollection = term.Groups[taxonomyGroupName].TermSets[taxonomyListName].GetAllTerms();
orderList = myTermCollection[0].TermSet.CustomSortOrder;
I'm not sure for what myTermCollection[0].CustomSortOrder stands for, but it's not what I need. 我不确定myTermCollection [0] .CustomSortOrder代表什么,但这不是我所需要的。 What I need is myTermCollection[0].TermSet.CustomSortOrder.
我需要的是myTermCollection [0] .TermSet.CustomSortOrder。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.