cancel
Showing results for 
Search instead for 
Did you mean: 

BindAggregation for custom control

Former Member
0 Kudos

Greetings all

After creating a custom control:

sap.ui.Control.extend("CustomControl")

{

     aggregations:

     {

          "tokens":{  type:"sap.m.Token", multiple:true, visibility: "public"}

     },

     init: function()

     {

          var control = this;

          control.tokenContainer = new sap.m.Tokenizer(

          {

               tokens: control.getAggregation("tokens");

          });

     },

     renderer:

     {

          render:function(oRm,oControl)

          {

                 oRm.renderControl(oControl.tokenContainer);

          }

     }

}

I would like to use bindAggregation as follows:

var customControl = new CustomControl();

var tokenTemplate = new sap.m.Token({text:"Test"});

customControl.bindAggregation("tokens", "somePath", tokenTemplate);

The bindAggregation call works fine in that it goes in and fetches the data and such. The problem is that the control doesn't render the tokens when binding is done. There should be some event that triggers when data is loaded and then rerenders the tokenContainer. 

It is preferred that this should happen inside the custom control. Rerender functions called outside it is not referred.

Thanks in advance for the help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Answers (0)