cancel
Showing results for 
Search instead for 
Did you mean: 

how to set focus line in a table after the data is reloaded?

Former Member
0 Kudos

any efficient solution to set focus line in a table after the data is reloaded?

For example, I create a record, and how to set focus on this newly created record? PS: the Id for this new record is generated before the data is reloaded.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Wei,

0. You have some ID that correspon to node element attribute

1. Use simple "for" loop over node elements till you find element with attribute equals to ID

2. Set node lead selection to element found: node.setLeadSelection( nthElement.index() );

VS

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Bhavik,

As my table is a tree table, the new line will be created under the parent record. So it does not always appear at the bottom.

Former Member
0 Kudos

Thanks for all of your advice.

In my case, maybe loop is necessary as the newly created does not always appear in the last line.

Former Member
0 Kudos

Hi Wei,

How you are adding newly created element in node?

I guess it always added at last.

If you know how to add element in between then share it with everybody. It would be helpful.

Regards,

Bhavik

Former Member
0 Kudos

Hi Wei,

Instead of doing for loop take the size of the node in which you have created the element.

Lets say:

int size = wdcontext.node<node name>().size();

As you have just added newly created element in node it is at the last position.

So, you can write following line of code to set focus on the newly created element:

wdcontext.node<node name>().moveLast();

OR

wdcontext.node<node name>().setLeadeselection(size-1);

Regards,

Bhavik

Former Member
0 Kudos

Check the position of the newly created row and

wdContext.nodeParentNode().setLeadSelection(pos);

Hope this will solve ur probs

AD

Former Member
0 Kudos

hai wei

can you explain your problem a bit more

regards

saravana