如何在 Tridion Web GUI 的弹出窗口中获取完整的嵌入式字段值集? [英] How to get the complete set of Embedded field values in a popup window in the Tridion Web GUI?
问题描述
我为 Tridion 2011 SP1 实现了一个功能区工具栏按钮,它打开一个 aspx 页面并填充基于查找组件的下拉列表.查找组件由不同的嵌入式模式组成.要根据嵌入式架构名称过滤掉值,我需要在按钮 JavaScript 中单击按钮时获取组件创建页面的嵌入式架构字段值.
I implemented a ribbon tool bar button for Tridion 2011 SP1, which opens an aspx page and populates a drop down list based on a look-up component. The look-up component comprises of different embedded schemas. To filter out the values based on embedded schema name I need to get the Embedded schema field values of component creation page on button click in button JavaScript.
因为在我的组件创建页面中包含多值嵌入式架构字段具有信息,这有助于查找值过滤过程.我不知道该命令需要用于该要求.我知道一个获取完整组件 XML 的命令,即:$display.getView().getItemFields()
.
Because in my component creation page consists of multivalued Embedded schema field has the info, which helps look up value filtering process. I am unaware of the command need to be used for the requirement. I know about a command to get the complete component XML, that is: $display.getView().getItemFields()
.
要获取当前的 RTF 字段内容,我将使用以下命令:target.editor.getHTML()
.要仅获取完整的嵌入式架构字段值,我需要使用哪个命令?
To get the present RTF field content I am going for the command: target.editor.getHTML()
. To get the complete set of Embedded schema field values only,
which command I need to use?
我的示例组件源:
<root>
<a>sample a</a>
<b>sample b</b>
<c>
<ca>ca 1</ca>
<cb>cb 1</cb>
<cc>cc 1</cc>
</c>
<c>
<ca>ca 2</ca>
<cb>cb 2</cb>
<cc>cc 2</cc>
</c>
<c>
<ca>ca 1</ca>
<cb>cb 1</cb>
<cc>cc 1</cc>
</c>
</root>
推荐答案
我认为没有公共 API.但是你可以使用组件数据xml,然后自己解析:
I don't think there are public API for that. But you could use component data xml and then parse it by yourself:
var item = $display.getItem();
var xml = item.getContent(); // OR $display.getView().getItemFields();
var xmlDoc = $xml.getNewXmlDocument(xml);
var schema = item.getSchema();
if(schema.isLoaded())
{
var xpath = "/custom:{0}/custom:embeddedFieldName".format(schema.getRootElementName());
var fields = $xml.selectNodes(xmlDoc, xpath, { custom: schema.getNamespaceUri() });
// loop fields and get values ...
}
这篇关于如何在 Tridion Web GUI 的弹出窗口中获取完整的嵌入式字段值集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!