cancel
Showing results for 
Search instead for 
Did you mean: 

Tree MultiSelect

Former Member
0 Kudos

Hi,

I have a tree displaying a heirarchy. This tree should have a facility of selecting multiple rows. To do this, I used the method that is most recommended, i.e. to have 2 images, one for each state of a checkbox and toggle betwwen the 2 on the onSelect event.

This is working fine except one minute detail. The onSelect should be triggered only with the item of the tree is selected and not when I click the expand/collapse image (triangle) at the side of each node. This works fine on clicking expand, i.e. the onSelect is not triggered, but on clicking collapse, the onSelect is triggered.

This is very annoying since if a user has expanded a node by mistake and has to collapse that node, the onSelect also gets fired and the state gets toggled.

Has anyone else also noticed this? I am using SP11, donno if this has been fixed in a future release.

Nirav

Accepted Solutions (0)

Answers (2)

Answers (2)

monalisa_biswal
Contributor
0 Kudos

get reference of your node type in doModifyView() method assign the

reference to a public static variable

public static IWDTreeNodeType nodeType;

nodeType = (IWDTreeNodeType) view.getElement("Node");

in the onAction event method

check whether it is expanded.

if (nodeType.getExpanded())

handle ur code accordingly

Former Member
0 Kudos

No, don't do this. Never store view element references in static view variables, this will not work.

Armin

Former Member
0 Kudos

Hi Monalisa,

Yes, besides, you are for getting...as I have said, I need to keep each and every node of the tree selectable. So a user may not yet have expanded a particular node, but may want to select it.

Thanks for trying.

Nirav.

monalisa_biswal
Contributor
0 Kudos

set ignoreAction property of tree node to true.

I hope it ll help u.

Former Member
0 Kudos

Hi Monalisa,

This property completely disables the onAction event. I cant do this since it I need to fire it to change the state of the checkbox.

Hasn't anyone noticed this problem before?

Nirav.

Former Member
0 Kudos

Hi ,

Please atleast tell me if this is a problem on my side.

Waiting...

Nirav.

Former Member
0 Kudos

Hi Nirav,

I suppose this is a problem on your side. Because i have never come across this problem till now. Just set ignoreAction as true for all the 'parent nodes' (i.e nodes which have atleast a child) and as false for all the leaf nodes. Write the code for loading the children in your 'onLoadChildren'. This will be invoked the first time, you click on expand icon. After this, as far as I know, any click on the expand collapse button doesn't have any effect on the data being populated.

Best regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

I am using a recursive node for the tree.

I have to implement a multiple selection on the entire tree. I am doing this with a checkbox image logic as I have explained before. Also, all nodes in my tree are to be selectable. It can be a parent node (i.e nodes which have atleast a child) or a child node. So, as I said in my previous reply, I cannot set the ignoreAction to false because I need the parent node also to be selectable.

Nirav

Former Member
0 Kudos

Hi Nirav,

I'm sorry for not understanding your scenario properly. Generally when we use tree, we associate actions only to the leaf nodes. Even if we associate actions to parent nodes, those will be usually expand collapse action, which we need to handle inside the onSelect action. It felt very strange to hear about this problem, so I tried out your scenario and it surely looks like a bug. And in this case we cannot have any workarounds too, because the triggering is being handled internally and they are triggering the 'onSelect' action on 'collapse' event too. So, as such there is no solution for your problem

Best Regards,

Nibu.

monalisa_biswal
Contributor
0 Kudos

get reference of your node type in doModifyView() method assign the

reference to a public static variable

public static IWDTreeNodeType nodeType;

nodeType = (IWDTreeNodeType) view.getElement("Node");

in the onAction event method

check whether it is expanded.

if (nodeType.getExpanded())

handle ur code accordingly