Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 05, 2015 at 08:59 AM
    Add comment
    10|10000 characters needed characters exceeded