New role

April 21 2008

  • 4 replies.
  • This question is resolved, if you still have a question, you can re-open it by reacting to it.
  • This question was started by Mohamed.
  • Last post by Carl.
Mohamed
member
21 April, 14:31
Hi,

I have created a lookup for a new element.
Basically, when adding this element I would like to display that lookup.
How do I add that new role?

Thanks,
Carl
Xopus Team
21 April, 14:48
You raise a fair question, but lookups cannot be created for elements (don't ask why). They can only be set for attribute nodes.

It is also not a role, but a configuration. To make sure that the lookup opens for the attribute when the element is created make sure that the schema says that the attribute is required and that forceLookup="true" and autoOpen="true" are set in the lookup configuration.

There are alternatives for creating lookups, such as inline lookups. These could be modified to work for elements, I think:

http://xopus.com/devblog/2007/creating-an-inline-lookup/

To open this lookup when the node is created you would have to look at event handling and the API.

http://xopus.com/Documentation/Developer%20Guide/How%20To/Use%20The%20API

I hope that helps.
Mohamed
member
21 April, 15:15
Carl,

This is what I added in the configuration:

<x:lookup autoOpen="true"
forceLookup="true"
name="name"
parentPattern="self::exterior"
url="lookupFeatures.jsp"/>

When I add an element exterior it is added in the XML but the lookup doesn't show.

Thanks,
Mohamed
member
22 April, 08:20
I have added the following event, it seems to be doing what I want I haven't tested top.choose() though.

Is it the correct way?

function doAfterChildInserted(evt) {
var node = evt.childNode;

if (nodeName == "exterior" || nodeName == "interior") {
node.openAttributesEditor();
}
}

Thanks,
Carl
Xopus Team
28 April, 14:16
It depends on the schema. If the schema never says that name is a required attribute on the exterior element, nothing will happen, because nothing needs to happen.

Make sure that your schema says something like

<xs:attribute name="name" use="required" ... />

That would make the code you wrote unnessary


React

HTML will be shown as HTML code.
Linebreaks and Links starting with http:// are automatically resolved