cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox in Treeview on UI5

Former Member
0 Kudos

Hello,

I am trying to create a tree view with checkbox selections and am unable to do it in UI5. I read somewhere that we can install external widgets if someone provides. Below are the 2 questions:

1) Is there a possibility of adding checkbox in a tree view in UI5?

2) In case we use an external widget, how can we integrate the external widget in WEB IDE?

Thanks,

Charles

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please have a look into the below link

TreeTable - sap.ui.table

regards,

Nagarjun

Former Member
0 Kudos

Hello Nagarjun, Is there any way where the checkbox could be with the node and not in a separate column?

Former Member
0 Kudos

Hello charles,

Have a look into the below link, it suits based on your requirement,

Edit fiddle - JSFiddle

Former Member
0 Kudos

Hello Nagarjun,

I checked the code, when the sub-node is selected, the parent node does not get auto-selected. Is there anyway we could do that?

Thanks for the help,

Charles

former_member182862
Active Contributor
0 Kudos

HI Charles

Will this work?

Sample

-D

Former Member
0 Kudos

Hello Dennis. This works perfectly. I am struggling with one other thing since I am new to UI5. The data that I have in the odata service is of the structure { NodeID, ParentID, Description }. How do I convert this to the tree like array?

Thanks a lot for your help

Charles

former_member182862
Active Contributor
0 Kudos

HI Charles

It is kind of difficult to help you here. What you need to do it to map the result of oData to the json format like in my sample code. You can attachRequestCompleted listener to your model.

-D

Former Member
Former Member
0 Kudos

Thank you indrajith. This helps

Former Member
0 Kudos

Helle Dennis. Thanks for the help. With help from Indrajith's link I was able to map the odata to json format and create a tree view.

Former Member
0 Kudos

Hi Dennis,

In the sample there is a small bug. The below code needs to be removed from the function validate_parent( )

  if (path === '/root') {

    return;

  }

Due to this code, if we check the node under the root node, it unchecks all the children instead of checking it and vice versa.

Otherwise the code is working perfectly.

Thanks,

Charles

former_member182862
Active Contributor
0 Kudos

thanks Charles

-D

Answers (1)

Answers (1)

Former Member
0 Kudos

There is a website that offers tree view on checkboxes on top of the existing UI5 library:

http://sapui6.com/all-controls/#all