cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in the TreeTable of Sapui5

rogerio_ribeiro2
Explorer
0 Kudos

Hello Experts,

please, how could I fix a problem in the TreeTable, when it keeps showing "arrows" to expand the next level, even when it is the last one.

I suppose it is due to the metadata in the model, and could work properly if I clear each __metadata. As I'm not sure if it is the best solution for this problem, or if I could have problems latter for cleaning metadatas, would you have another idea?

Follows a part of the code and a print screen. Thank you!

var oFirstTemplate = new sap.m.ObjectIdentifier().bindProperty("text", {
	parts: [{
		path: "CustomerID"
	}, {
		path: "OrderID"
	}],
	formatter: function(CustomerID, OrderID) {
		if (OrderID) {
			return "";
		} else {
			return CustomerID;
		}
	}
});

var oTreeFirstColumn = new sap.ui.table.Column({
	label: "CustomerID",
	template: oFirstTemplate
		// template: "CustomerID"
});

var oTreeSecondColumn = new sap.ui.table.Column({
	label: "Name",
	template: "ContactName"
});

var oTreeThirdColumn = new sap.ui.table.Column({
	label: "Order Id",
	template: "OrderID"
});

var oTreeTable = new sap.ui.table.TreeTable("idTreeTable", {
	columns: [
		oTreeFirstColumn,
		oTreeSecondColumn,
		oTreeThirdColumn
	],
	selectionMode: sap.ui.table.SelectionMode.Single,
	enableColumnReordering: true,
	expandFirstLevel: true
});

oTreeTable.bindRows({
	path: "/Customers",
	parameters: {
		expand: "Orders",
		arrayNames:["Orders"],
		navigation: {
			"Customers": "Orders"
		}
	}
});

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

HI Rogerio

The easiest way is to reorganize your data

example https://jsbin.com/mozezav/edit?html,output

rogerio_ribeiro2
Explorer
0 Kudos

Hi Dennis, it worked. Thank you for your help

Answers (3)

Answers (3)

Nigel_James
Active Contributor
0 Kudos
rogerio_ribeiro2
Explorer
0 Kudos

It has worked with the Dennis' suggestion but I will also try yours.

Thank you Nigel!

junwu
Active Contributor
0 Kudos

probably you don't have other option.

rogerio_ribeiro2
Explorer
0 Kudos

Thanks Jun

rogerio_ribeiro2
Explorer
0 Kudos

Dear @Moderators,

would you have some tip or idea about how to solve this problem?

Thanks