cancel
Showing results for 
Search instead for 
Did you mean: 

shrinking

Former Member
0 Kudos

hi everybody,

The thing is in tree having parent nodes are there each parent node having corresponding child nodes are there

whenever i clik the parent node then i am getting child nodes again i am cliking another parent node that corresponding nodes are coming but previous child nodes are also staying like that it does not goes that child nodes how it possible

The thing is clik any number of parent nodes but i want only one parent node childs will display on the screeen

tony

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Tony,

First option: (not sure if it works) make child nodes singleton, this way only elements on lead selection path should be visible.

Second: bind "expanded" property of TreeNodeType to some boolean attribute, say IsExpanded, for every onAction in tree save current parent and if previously saved instance exists set IsExpanded to false.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

hi Silaev,

u have given idea but in onAction how can i write the code please give me coding in tree onAction method

tony

Former Member
0 Kudos

Tony,

I've found even better way.

To make discution concrete, let us assume that I have node Companies and child node (non-singleton) Products, both with attribute Name (string)

1. Add 2 attributes to node Companies, both type boolean, first one IsExpanded, second one IsExpanded<b>X</b>

2. Make attribute IsExpanded<b>X</b> calculated, getter and setter should be generated.

3. Add the following at the end of view controller (between "//@@begin others" and "//@end"):


private IPrivate<ViewName>.ICompaniesElement _elLastCompany;

4. Write code for getter of IsExpanded<b>X</b>:


return element.getIsExpanded();

5. Write code for setter of IsExpanded<b>X</b>:


element.setIsExpanded( value );
if ( value )
{
  if ( null != _elLastCompany && element != _elLastCompany )
  {
    // Skip phantoms
    if ( null != _elLastCompany.node() )
      _elLastCompany.setIsExpanded( false );
  }
  _elLastCompany = element;
}
else if ( element == _elLastCompany )
{
  _elLastCompany = null;
}

6. Create Tree UI control, set Companies as data source

7. Create TreeNodeType for node Companies, bind property "text" to Companies.Name, <b>bind property "expanded" to IsExpanded<i>X</i></b>.

8. Create TreeItemType for node Products, bind property "text" to Companies.Products.Name

Build, deploy, run

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Tony,

Have you checked this solution? Does it work for your requirements?

If so, please close the thread.

VS