Skip to Content
avatar image
Former Member

Issue in the TreeTable of Sapui5

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"
		}
	}
});

duvida.png (15.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 05, 2017 at 05:16 AM

    HI Rogerio

    The easiest way is to reorganize your data

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 02, 2017 at 08:00 AM

    Dear @Moderators,

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

    Thanks

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 02, 2017 at 12:25 PM

    probably you don't have other option.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 28 at 02:19 AM
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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

      Thank you Nigel!