Skip to Content
0

sap.m.tree with mode: multiselect -> make checkboxes NOT editable

Mar 14, 2017 at 12:06 PM

46

avatar image

Hello everybody,

is it possible to make the checkboxes of a sap.m.tree with mode multiselect so that they are not editable anymore?

The case I have looks similar to this:

I have also set this up in jsbin:
http://jsbin.com/lemerusapa/edit?html,js,output

Now I would like to make sure, that once the tree is loaded the checkboxes cannot be edited anymore.

I guess, that I will have to access the "editable-porperty" of the checkboxes:

But I didn't specifically create the checkboxes, but rather just chose the mode="MultiSelect" for the Tree in order for the checkboxes to show up. And now I have no clue how to access them to change the property.

Thanks in advance for your help!

tree.png (6.9 kB)
checkbox.png (30.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Dennis Seah
Mar 15, 2017 at 01:18 AM
1

Hi

Will this work for you?

http://jsbin.com/vexoso/edit?html,js,output

Thanks

-D

Share
10 |10000 characters needed characters left characters exceeded
Srikanth KV Mar 14, 2017 at 10:04 PM
1

Tree control is a composite control which contains check box and text elements. Check box properties cannot be accessed directly as this is defined as a private aggregation...

Found a dirty method for your problem(dont use this in production as after upgrade's property name might change). use the below code to disable check box...in this case disabling checkbox for item 0 (root item)

this.getView().byId("Tree").getItems()[0]._oMultiSelectControl.setEditable(false);

Update JSBin code

Share
10 |10000 characters needed characters left characters exceeded
Srikanth KV Mar 14, 2017 at 09:48 PM
0

From UIControl(tree) point of view multi select means you are enabling the control so that user can select entries. With standard properties this may not be possible....

Share
10 |10000 characters needed characters left characters exceeded
Daniel Spiess Mar 15, 2017 at 08:23 AM
0

Thanks to both of you for your quick help!

Share
10 |10000 characters needed characters left characters exceeded