Skip to Content
avatar image
Former Member

dynamic binding

Hi All,

I have a context node "header" and it has two context attributes "att1" , "att2"

att1 is of type string

att2 is mapped to a simple dictionary (having hardcoded values for the drop down)

In the view i have 2 dropdown

dropdown1 with values "A" , "B"

My requirement is when i chose "A" from the 1st drop down

The second drop down should be mapped to att1

if i chose B from the 1st drop down

The second drop down should be mapped to att2

Thanks

Suresh

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 06, 2009 at 03:19 AM

    Hi Suresh,

    Please use this code:

    // I am assuming that the value of the first dropdown is stored in context attribute "DropDownValue" which is directly under context node. 
    // Please use appropriate attribute name if it differs.
    String value  = wdContext.currentContextElement().getDropDownValue();
    IWDDropDownByKey DDK = (IWDDropDownByKey)view.getElement("DROP_DOWN_ID");
    if(value.equalsIgnoreCase("A")){
    	IWDAttributeInfo attrinfo = wdContext.nodeHeader().getNodeInfo().getAttribute("Attr1");
    	DDK.bindSelectedKey(attrinfo);
    }
    else if(value.equalsIgnoreCase("B")){
    	IWDAttributeInfo attrinfo = wdContext.nodeHeader().getNodeInfo().getAttribute("Attr2");
    	DDK.bindSelectedKey(attrinfo);
    }
    

    I hope this solves the issue. Please revert back in case you need any further information on this.

    Thanks and Regards,

    Pravesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2009 at 06:11 AM

    Hi suresh,,

    This code should be written in wdDoModify method in View controller

    String value = wdContext.currentContextElement().getDropDownValue();

    IWDDropDownByKey DDK = (IWDDropDownByKey)view.getElement("DROP_DOWN_ID1");

    IWDDropDownByKey DDK1 = (IWDDropDownByKey)view.getElement("DROP_DOWN_ID2");

    if(value.equalsIgnoreCase("A")){

    IWDAttributeInfo attrinfo = wdContext.nodeHeader().getNodeInfo().getAttribute("Attr1");

    DDK1.bindSelectedKey(attrinfo);

    }

    else if(value.equalsIgnoreCase("B")){

    IWDAttributeInfo attrinfo = wdContext.nodeHeader().getNodeInfo().getAttribute("Attr2");

    DDK.bindSelectedKey(attrinfo);

    }

    Thanks

    Jati

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2009 at 07:48 AM

    Thanks.. it works 😊

    Regards

    Suresh

    Add comment
    10|10000 characters needed characters exceeded