cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownByIndex - SetLeadSelection-Question

Former Member
0 Kudos

Hi There,

This is my problem:

I have 2 DropDownByIndex-Boxes. One has the values from a avlue node attribute, the other from a model node attribute.

By pressing a button, i want to set the selection to blank. I do this with setLeadSelection(IWDNode.NO_SELECTION)

At the value node, this works without problems, but at the model node, the node is be invalidatet, and the DropDown is empty after doing this. Why? Is there a possibility to do what I want without executing the model again?

thanks a lot

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

If you want it to default it to a specific value, set it like this

wdContext.nodeX().setLeadSelection(0);

You need to create a context node with cardinality 0..n

and insert a value atribute as u mentioned to this node.

To Populate the dropdown,write the code in wdDoInit() method.

String[] values = new String []{"AAA", "BBB", "CCC"};

List nodeElements = new ArrayList();

for (int i = 0; i <letters.length; ++i)

{

IPrivate<your view name>.IXElement xElement =

wdContext.createXElement();

xElement.setY(values);

nodeElements.add(xElement);

}

wdContext.nodeX().bind(nodeElements);

If you give the below statment it will default the value in dropdown to "AAA"

wdContext.nodeX().setLeadSelection(0);

On some event, you can capture the selected values of the dropdownlist...

Hope this helps.

Regards,

Abhishek.

Former Member
0 Kudos

Hi, thanks, but that is not the solution to the problem i explaned:

the problem was the follow: I wanted to remove the leadSelection from a model-node, but when you set this in a model-node with setLeadSelection(IWDNode.NO_SELECTION), the node will be invalidated, and you need to execute the model again. But that i didn't wanted. If I would want that, I would invalidate the node on the right way.

So my question was, is there a possibility to remove the leadselection in a model-node without to execute the model again after.

I have already copied the Values from the model node into a new value-node (like I proposed it in my second post), where the setLeadSelection(IWDNode.NO_SELECTION)-Code works without problems. So its not required to execute the model several times.

Former Member
0 Kudos

J N,

Could you post here exact context structure that is related to DropDownByIndex controls? Something like this:


Context
 - [NodeA] (model, 0..n, sel 0..1, singleton) 
    - @Attr1
    - @Attr2
    - [NodeB] (value, 1..1, sel 1..1, non-singleton)
       - @AttrX 
       - @AttrY 

Please use "code" section to preserve formatting (when editing message, pay attention to tollbar above input area -- "code" button is here)

VS

Former Member
0 Kudos

Dear JN,

You can try this. I have checked. This is working!!

If xyz is the model node in your view, in the action of the button which you press, do the following:

IWDNode node= (IWDNode)wdContext.nodexyz();

Now proceed with your setLeadSelection:

node.setLeadSelection(IWDNode.NO_SELECTION);

Remember: You should call the node of the view! Not of the Controller!! Here xyz is the model node of the view mapped to some controller node. xyz's model attribe is displayed in the dropdown.

By doing this, you neednot execute model again and again.

Hope this helps you. Let me know, if I can provide more!

Regards,

Pawan.

Message was edited by: Pawan Kumar P S S R L N

Former Member
0 Kudos

Hi, thanks a lot for your help, but thats exactly the same what I am still doing with the model-node. My question was:

If I remove the leadselection from a Value-Node, the values will not be removed, but when I remove the leadselection from a model-node, I need tho execute the model again. Is there a possibility to realize that in an other way, so that isn't needed to execute the model again, or is that the only way?

-Of corse i could copy the values into a value node, but isnt there a more comfortable way?

thanks a lot

kindest JN