Manpreet
Manpreet

Reputation: 21

SAPUI5 tile container OData binding with filters

I am trying to display the data from a OData service into a tile where I need to pass some filters to the OData service. I am using the below code however I am getting the error "No template or factory function specified for bindAggregation function of tileContainer".

var tileContainer = new sap.m.TileContainer("tileContainer",{
            height:"80%",
              allowAdd : true,
              editable : false
        });
        var templateTile = new sap.m.StandardTile("tileTemplate",{
              title : 'Orders',
              number:'{COUNT}',
                 info:'Number of Orders',
              icon:"sap-icon://bar-chart",
              });
        oModel = sap.ui.getCore().getModel();
        tileContainer.setModel(oModel);

        tileContainer.bindAggregation('tiles',{path : "/OrderSet", filters: [f1, f2]}, templateTile);

         new sap.m.App({
              pages : new sap.m.Page({
                enableScrolling : false,
                title : "tile container",
                content : [tileContainer]
              })
            }).placeAt("content");

Can some one tell me what am I doing wrong here.

Upvotes: 0

Views: 1582

Answers (1)

Ashish Patil
Ashish Patil

Reputation: 1742

bindAggregation has two parameters; sAggregationName and oBindingInfo and in your code template is passed outside the oBindingInfo object, hence it is not available, which is reason for your error.

You can also pass individual parameters instead of passing them in oBindingInfo object. But in that case sequence of parameters has to be maintained.

Update bindAggregation method's parameter syntax with this

tileContainer.bindAggregation("tiles",{
    path: "/OrderSet",
    filters: [f1, f2],
    template: templateTile
});

Upvotes: 0

Related Questions