on 04-28-2005 5:57 PM
Hi,
i have created a recursive tree
Now i want to do the following things
1. Provide a checkbox to every node
2. if a node is checked then all its subnodes should be checked
(This is like context mapping in web dynpro i.e. if the root node is checked then all the nodes under it also gets checked.)
Can anyone please help me in solving this.
Thanks n Regards
Akshay
Hi Akshay,
Everything mentioned here step by step:
0. You cannot use check-boxes inside tree, so you have to emulate them with images (or use Table with Tree-like master column -- not discussed in this message)
1. Create boolean attribute <b>isChecked</b> in node
2. Create calculated read-only string attribute cbIcon, write following in generated getter function:
return element.getIsChecked() ?
"~sapicons/b_okay.gif" : "~sapicons/b_canc.gif";
or whatever images you are using.
3. Create & bind action onAction for TreeNode / TreeItem.
-- apply parameters mapping in wdDoModifyView:
if ( firstTime )
{
final IWDTreeNodeType treeNode = (IWDTreeNodeType)
view.getElement("<your-tree-node-element-id>");
treeNode.mappingOfOnAction()
.addSourceMapping("path", "selectedElement");
}
<b>Your action must define parameter with type of your node element and name <i>selectedElement</i></b>
-- write the following code for handler:
selectedElement.setIsSelected( !selectedElement.getIsSelected() );
4. Bind cbIcon attribute as TreeNode / TreeItem image source, bind rest of attributes.
--Done.
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Akshay ,
Currently there is no way to insert a checkbox(UIElement) in a TreeNode/TreeItem.
What i am suggesting is you can assign an icon to the nodeItem (Checked Icon and UncheckedIcon)
On CLick evenet of treenode you can change the icons (Toggle) and depending upon that you can bind the nodes under that with repective Icons.
Regards, VIP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am sorry i am totally confused with other things
You can create a ValueAttribute(type String) for storing the imageName and you can change the image on click.
Regards, VIP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you want to check/uncheck a checkbox you should bind the checked proprty to a context attribute of type "boolean".
So create value attribute of type boolean and bind the checkbox to the same.
Regards, VIP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please modify one of the atribute to boolean and bind the checked property of the checkbox to this value attribute.
Similarly you can create another value attribute and store the image filename in that and bind that to the image of the UILEment.
Regards, VIP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Akshay ,
I am not sure weather this is the correct answer or not but just you can give a try !!
Create a action "OnSelect " for the node.
On click just set the attribute value to true or false.(toggle)
Ex: wdContext.currentNodeElelemt().setAttribute(true);
Regards, VIP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi VIP,
i tried with the action "onSelect" for the node.
But, setAttributValue method doesnt take boolean value, it takes two args of type String and Object.
if u can suggest anything on this, it will helpful.
I hv got one more thing in mind. in the tree properties there is one property called defaultNodeIconSource and defaultItemIconSource.
i dont know much abt this. but if we can put a image at tht node and change tht image at runtime e.g. making it a checked(tick) one . now we can check the no of images checked and get those multiple nodes selected.
is this possible?
i dont know how to go abt it.
Can u please help in this.
Thanks n Regards
Akshay
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.