Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BindAggregation for custom control

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.

Former Member
Former Member replied
Not what you were looking for? View more on this topic or Ask a question