cancel
Showing results for 
Search instead for 
Did you mean: 

Set leadselection to specific element

Former Member
0 Kudos

Hi all,

supose i have a node Banks with the following attributes:

- id

- name

- ...

Is it possible to set the leadselection to BanksElement with a specific id without looping over all the elements?

I thought SetTreeSelection(Element e) might do the trick, but it gives me a nullpointer:

I tried it the following way.

string id = "3";
Bank b = new Bank();
b.setId(id);
wdContext.nodeBanks.setTreeSelection(wdContext.nodeBanks.createElement(b));

The Bank object has an equals method that says to banks are equal when their id is equal...

The setTreeSelection, how does it know when it has reached the element that is given to it?

If i use the setTreeSelection the following way it does work:


Element el = wdContext.nodeBanks.getElement(3); // get element at index 3 for example
wdContext.nodeBanks.setTreeSelection(el);

This is not sufficient, because i only know the id of the bank i'm want to set the leadselection to, nothing more...

Any idea how to do it, or is looping over all my elements the only way? (not really performant)

Kind regards,

J.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Joren,

Iteration over all elements are the only possible way.

And this is not slow -- iterating over 10000 elements is just several ms. Do not try to optimize performance of your code before you get the working code itself -- you know, premature optimization....

Valery Silaev

SaM Solutions

http://www.sam-solutions.net