cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic binding

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks.. it works

Regards

Suresh

Former Member
0 Kudos

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