Skip to Content
author's profile photo Former Member
Former Member

Problems with dynamic IWDDropDownByIndex generation / context binding

Hello everybody,

I am dynamically generating IWDDropDownByIndex elements from the context. As many Question nodes do exist, IWDDropDownByIndex elements are created. For the first element it works fine, but after generating the second one, the first element has the same texts to select than the second one.

I am using the following context:

root

+++Question(Node)

+++

+++Caption(Attribute, String)

+++

+++++AnswerOptions(Node)

+++++

+++++Answer(Attribute, String)

(Question is a singleton node with parent root and attribute Caption, AnswerOptions is a non-singleton node with parent Question and attribute Answer - both cardinalities are 0..n)

For generating the UI elements I use:

//one loop each question

for (int i=0; i < wdContext.nodeQuestions().size(); i++) {

wdContext.nodeQuestions().setLeadSelection(i);

IWDDropDownByIndex dropDown = (IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class, (i+1) + "Drop Down" + 1);

//the number of DropDown texts to select is determined by the number of AnsweringOptions

dropDown.bindTexts("Questions.AnswerOptions.Answer"); dropDown.setOnSelect(wdThis.wdCreateAction(IPrivateTestPrototypeView.WDActionEventHandler.DROP_DOWN_SELECTION,""));

dropDown.mappingOfOnSelect().addSourceMapping("index","SelectedIndex");

questionGroup.addChild(dropDown);

}

It seems that bindTexts("Questions.AnswerOptions.Answer") always points to the same question node and therefore even previously added DropDown elements change their texts. How can I prevent already added IWDDropDownByIndex elements from changing their texts?

Thank you for your help!

Tom

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2005 at 12:27 PM

    Hi Tom,

    I think u will not be able to bind different instances of a node to different UI elements.Even at Design time u will not be able bind different instances so it will not be possible at runtime also.All the dropdowns u r creating is binded to a single instance .so with change in one dropdown it is also getting reflected in others.

    It is possible when u use table UI element bcoz each row of a table will have diffrent instances.

    Regards,

    Sowjanya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2005 at 01:12 PM

    Hi Tom,

    What you want to do IS possible. You have to ensure that you create a unique NodeInfo for every question node.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.