How to get a full set of values ​​of embedded fields in a pop-up window in the Tridion Web web interface?

I implemented a ribbon toolbar button for Tridion 2011 SP1 that opens an aspx page and populates a drop-down list based on the search component. The search component contains various built-in schemas. To filter values ​​based on the embedded schema name, I need to get the values ​​of the Embedded schema field values ​​on the component creation page when I click the button in the JavaScript button.

Because on my component creation page it consists of a multi-valued field Embedded schema, which contains information that helps to search for the process of filtering values. I do not know which command should be used for this requirement. I know about the command to get the full XML component, namely: $display.getView().getItemFields() .

To get the current contents of the RTF field, I'm going to run the command: target.editor.getHTML() . To get a complete set of field values ​​for an embedded schema, which command do I need to use?

My component sample:

 <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> 
+4
source share
1 answer

I do not think there is an open API for this. But you can use the xml component data and then parse it 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 ... } 
+6
source

Source: https://habr.com/ru/post/916234/


All Articles