3

Does someone know if there is a way to create a OData Service that is bindable to an SAPUI5 TreeTable element?

According to the example from here: https://sapui5.netweaver.ondemand.com/sdk/#test-resources/sap/ui/table/demokit/TreeTable.html

The recursive structure of the data is a list. For example:

//Define some sample data 
var oData = {
        root:{
            name: "root",
            description: "root description",
            checked: false,
            0: {
                name: "item1",
                description: "item1 description",
                checked: true,
...

I expected to solve that problem with an navigation at the service side. Like

Element with attributes and one attribute points to a list of Elements.

But this would not be the same.

I also detected this thread, but the answer is one year old: http://scn.sap.com/thread/3389546

All in all, is the answer still true? Or is there a solution, so that the data binding works?

4

1 回答 1

4

You can use treebinding from ODataModel. First of all, prepare backend. You need to cycle navigation in your entity set. For example, you have entity set ItemCollection and you add navigation property ItemNavigation which refers to ItemCollection. After just bind tree to your TreeTable:

var oTreeTable = this.getView().byId("myTreeTable");
oTreeTable.bindRows({
    path : '/ItemCollection',
    properties : {
        navigation : {
            'ItemCollection' : 'ItemNagigation'
        }
    }
});

Should work fine but be aware to use it with Tree control. TreeTable loads navigation item by click on its parent and Tree loads the whole tree at once.

于 2014-07-24T07:40:09.967 回答