Skip to Content

UI5 - TreeTable with XML Model Rendering Issue

I am currently construting a tree table in XML view with XML Data Model.

Following is My XML:

<?xml version="1.0" encoding="utf-8"?>
<name>Case Packer</name>
<name>Scheduled Operations</name>
<name>Major Changeover</name>
<name>Paid Break</name>
<name>Running Production</name>
<name>Labeler 1</name>
<name>Bottle Coder</name>

Following is My XML View:

<?xml version="1.0" encoding="utf-8" ?>
<Page showHeader="false" enableScrolling="false">
<l:Splitter orientation="Vertical">
<Page title="TreeTableDemo">
<!-- rows="{path:'/Rowsets/Rowset/Row/Root', parameters: {arrayNames:['/children']}}" -->
<t:TreeTable id="idProductionTable" rows="{path:'/Rowsets/Rowset/Row/root', parameters: {arrayNames:['/children']}}">

<Title text="Production"/>
<t:Column width="130px" demandPopin="true" id="idProdReportNode" showSortMenuEntry="false"
<Label text="NAME" design="Bold" />
<ObjectIdentifier text="{name}" />
<t:Column width="130px" demandPopin="true" id="idProdReportProdCount" showSortMenuEntry="false"
                                                        minScreenWidth="Tablet" hAlign="End">
<Label text="Level" design="Bold" />
<ObjectIdentifier text="{level}" />

Following is my controller:

sap.ui.controller("treetabledemo.TreeTableDemo", {

onInit: function() {

    var sPath = "resources/data/treedata.xml"; 
    var oModel = new sap.ui.model.xml.XMLModel(sPath);
    var that = this;

    var oTable = this.byId("idProductionTable");



But it gives me following error:

Uncaught Error: Path path:'/Rowsets/Rowset/Row/root', parameters: {arrayNames:['/children']} must start with a / 
    at d.a.getContext (sap-ui-core.js:1549)
    at f.c.applyFilter (sap-ui-core.js:1381)
    at f.c.checkUpdate (sap-ui-core.js:1386)
    at f.B.initialize (sap-ui-core.js:1313)
    at f.h._bindAggregation (sap-ui-core.js:511)
    at f.z._bindAggregation (Table.js:6)
    at f.h.updateBindings (sap-ui-core.js:517)
    at f.h.setModel (sap-ui-core.js:528)
    at constructor.onInit (TreeTableDemo.controller.js:15)
    at f.a.fireEvent (sap-ui-core.js:449)

I tried various permutations and combinations but it does not seem to work.

What am I doing wrong here?

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2017 at 04:46 PM

    In an XML model, we will have to ignore the root element while binding the nodes.

     rows="{path:'/Rowset/Row/root', parameters: {arrayNames:['/children']}}"

    Please try this as a path.

    However, you would probably see lot of empty rows displayed in the output. That's because you are trying to recursively iterate over "/children" node and it has other nodes like "id", "name", "level" nodes in it. So, on iterations these additional nodes will be displayed as empty rows.

    I am not sure how we can get rid of this. If i happen to find it out, I will update my answer.

    Add comment
    10|10000 characters needed characters exceeded