on 06-22-2005 6:14 PM
Hello,
how can I remove the focus from a tree, so that
none of the elements in the tree is selected?
I have tried using the following methods:
setTreeSelection(null);
setLeadSelection(IWDNode.NO_SELECTION);
None of them worked.
Any help highly appreciated.
Greetings,
Tomek.
Hi Tomasz,
Try the following code.
IPrivateLeftView.IRootNodeElement se = wdContext.nodeRootNode().getRootNodeElementAt(0);
wdContext.nodeRootNode().setTreeSelection(se);
Here RootNode is the main root node in my context.
It will focus on the top node and so initially you can get tree in closed state.
Let me know the status.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhavik,
thanks for your piece of advice, but what I want
to achieve is to remove the focus from the entire
tree (rather than move it to the root node).
I wan the tree to remain expanded, but without
any node selected. I have managed to achieve it
when the page is opened initially. However when
the user selects any node in the tree, and than
leaves the tree by selecting any other UI element,
the tree node still remains selected (i.e.
hihglighted).
Greetings,
Tomek.
Hi,
May be you can use .requestfocus() in the runtime to change the focus to some other control.
Regards, anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tomek / Bharathwaj,
Did u check with this method
wdThis.wdGetAPI().requestFocus(IWDNodeElement nodeElement, IWDAttributeInfo attribute)
IWDAttributeInfo attribute
= wdContext.nodeXYZ().getNodeInfo().getAttribute(
IPrivateMyView.IXYZElement.ABC);
wdThis.wdGetAPI().requestFocus(wdContext.currentXYZElement(), attribute);
Regards,
Santhosh.C
Hi Santhosh,
thanks for your kind help, but unfortunately it didn't
work in my case. It seems to me the problem is not that
the focus is not transferred from one UI element to
the other. Rather than that the problem is that
it does not leave the "old" element.
I will describe it with my example: I have 2 trees
displayed on one page: A & B. Initially only one
node of the A tree is selected (has focus). So far,
so good. But when the user clicks on a node of
the B tree, the node previously selected in the
A tree is still highlighted. So the user sees both
nodes (one in tree A, and another one in tree B)
highlighted (selected).
Greetings,
Tomek.
Hi Tomek,
The one what you are talking is selected tree node, for this we can not use the "requestFocus()", by saying "requestFocus()" to another UI element, will not remove the tree selection.
This behaves similar to Table UI element, if one row is selected in a table and the focus is moved to another UI element also, the selected row will not be deselected.
Regards,
Santhosh.C
Hi Bharathwaj,
unfortunately it doesn't work in my case.
But there is one more very interesting observation...
Now I have managed to remove the focus from B tree
when the user clicks on a node of A tree. I did it
with the following code:
IWDTree foldersTree =
(IWDTree)thisView.getElement("TreeFolders");
foldersTree.requestFocus();
But this very same technique does not work when
applied to the tree A (i.e. when the user clicks
on a node of the B tree). Will investigate it
further...
Greetings,
Tomek.
Hello,
it seems I have found a (dirty) workaround to this
problem. If anyone is interested, details below:
When the user clicks on a tree node (say A tree),
I do the following:
1. request focus on the tree selected by the user
(say B tree):
IWDTree foldersTree =
(IWDTree)thisView.getElement("TreeFolders");
foldersTree.requestFocus();
2. invalidate the A tree (which causes the tree
to disappear)
wdThis.wdGetContext().nodeInbox().invalidate();
3. recreate the A tree (filling the context nodes)
4. unselect the A tree:
wdContext.nodeInbox().setLeadSelection(IWDNode.NO_SELECTION);
Thanks a lot to all of you who have responded.
Greetings,
Tomek.
Check your context nodes -- it seems that they have either selection cardinality 1..1 (i.e. mandatory selection) or has initializeLeadSelection proprty set to true (default, you need false).
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Check your context nodes -- it seems that they have
> either selection cardinality 1..1 (i.e. mandatory
> selection) or has initializeLeadSelection proprty
> set to true (default, you need false).
The cardinality is OK (0..1). The initializeLeadSelection
property was set to true, but changing it to false didn't
help. Initially (just after the page is displayed)
everything looks fine (the tree is not selected), but
after the user clicks on any node, and then tries to
move the focus to some other UI element, the tree
node remains highlighted.
I have managed to move the tree focus to the root
node, but what I want to achieve is to remove the
focus (highlighting) from the tree at all.
Greetings,
Tomek.
Try keeping the focus on someother UI element.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.