cancel
Showing results for 
Search instead for 
Did you mean: 

Question for TreeTable, child-nodes and dynamic list of columns

Former Member
0 Kudos

Dear all,

we are trying to use the SAPUI5 TreeTable with a JSON model (the support for a direct OData model seems not to be good enough yet).

We have to use a dynamic list of columns with dynamic names. A dynamic list of columns is possible via bindColumns/bindAggregation. For the column-creation we are using a factory-method. The path for the column-template-binding has to be created dynamically. So far ok.

But our for each row the values of the dynamic columns shall be stored in a object so that the JSON would look like:


-nodes (Object)

--Nodekey (Attribute)

--Text (Attribute)

--Icon (Attribute)

--Tooltip (Attribute)

---Child (Object)

----...

---COLUMN_1 (Object)

----ColumnName (Attribute)

----IconName (Attribute)

----Text (Attribute)

----Tooltip (Attribute)

----Nodekey (Attribute)

---COLUMN_2 (Object)

----ColumnName (Attribute)

----IconName (Attribute)

----Text (Attribute)

----Tooltip (Attribute)

----Nodekey (Attribute)

---COLUMN_N (Object)

...

These column node have to be underneath the node-date itself - otherwise a direct (relative) binding is not possible. Unfortunately the TreeTable interprets every object/array underneath the node itself as a child node. Why? How can this be solved for us?

The only idea I have is to use the formatter-function and to return the right data manually. The COLUM-Objects then would be no direct childs.

Regards, Stefan

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Maksim,

here is my jsbin:

http://jsbin.com/yigubupote/edit?html,output

@Robin: In my example on jsbin you might see, that there is also a usecase to have other objects than thildrens underneath an node If you have an other solution for me, I will be very thankful

Best regards,

Stefan

former_member182372
Active Contributor
0 Kudos

Stefan, why make things more complex than they should be

JS Bin - Collaborative JavaScript Debugging

Former Member
0 Kudos

Hi Maksim,

you missed some column-details - tooltip, icon, ...

Right now, I "flattened" the ColumnNode-Objects, e.g.

COLUMNNAME__Tooltip

COLUMNNAME__Text

...

But I think the TreeTable (as it's built now), is not in a good development-state. Besides my problems, there are multiple other problems (e.g. expand/collapse/leaf-icon not shown correctly,...)

Regards,

Stefan

former_member182372
Active Contributor
0 Kudos

lack of documentation, that's for sure. But where would be army of consultants (like me  ) if everything is perfectly documented and described in SAP

Qualiture
Active Contributor
0 Kudos

Well, as the name suggests, it's a Tree, so it makes perfect sense for any object or array under a parent node to be interpreted as child(s)

Looking at your JSON model for the rows, if you make it a flat structure for every row it should work

former_member182372
Active Contributor
0 Kudos

Stefan, jsbin example would be more helpful