cancel
Showing results for 
Search instead for 
Did you mean: 

How to refresh UI's contents accorging to changed parent node element?

Former Member
0 Kudos

Hello All,

I hava 1 parent node (Countries) and 1 child node for each parent element - Regions, "singleton" attr for Regions node is switched to false.


    IPublicTimeZoneInterface.ICountryNode cnode = wdContext.nodeCountry();
	IPublicTimeZoneInterface.ICountryElement c;
	IPublicTimeZoneInterface.IRegionElement r;
	String[] cn ={"Russian","France"};
	String[][] rn ={{"Moscow","SPb"},{"Paris","Marseille"}};
	for(int i = 0; i<cn.length;i++)
	{
		c = cnode.createCountryElement();
		c.setName(cn<i>);
		cnode.addElement(c);
		cnode.setLeadSelection(i);
		for(int j=0; j<rn<i>.length;j++)
		{
			r = cnode.currentCountryElement().nodeRegion().createRegionElement();
			r.setName(rn<i>[j]);
			cnode.currentCountryElement().nodeRegion().addElement(r);
		}
	}

Everything is fine when I output my context values by MessageManager (Russia is linked with Moscow and Spb, France is linked with Paris and Marseille), but when I placed two combo boxed (DropDownByIndex) on my View and bound them to nodeCountry and nodeRegion accordingly, I'v got the strange situation when after updating the first combobox (Countries), I must call any method which have to modify form (put string by Messagemanager or smth.like that) to make second combobox' set of regions changed

Question: How to refresh second combobox' contents according to new parent element selection?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

First, I would change your code into


String[] countries = {"Russia","France"};
String[][] regions = {{"Moscow","SPb"}, {"Paris","Marseille"}};
for (int i = 0; i < countries.length; ++i)
{
  ICountryElement ce = wdContext.nodeCountry().createAndAddCountryElement();
  ce.setName(countries<i>);
  for (int j = 0; j < regions<i>.length; j++)
  {
    IRegionElement re = ce.nodeRegion().createAndAddRegionElement();
    re.setName(regions<i>[j]);
  }
}

Now, if you bind two DropDownByIndex UI elements to node "Country" and sub-node "Region", assign an empty action to the Country-drop-down list. The effect is that after selecting a country, a server-roundtrip is triggered and the Region-drop-down list is updated according to the selected country.

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Alexandar,

You have to add the elements of the non singleton node to the parent node.

So use cn.create and then add the elements for the respective parent node. So that regions are bound to repective nodes.

Regards,

Amit