Skip to Content

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

Binding Issue - sap.m.Dialog to buttons aggregation

Hi All,

I’m writing to you with a problem that’s annoying me since I found it and I cannot come up with a solution. So I was wondering, if someone can actually see the where the problem is hidden.

I'm somehow not able to bind the model to a factory function. Here you can find a very simple example of my problem.


This one works, but isn't what I'm actually looking for, since the aggregation should depend on the model:


var oDialog = new sap.m.Dialog({

title: '{i18n>sap.im.ui.datasource.browse.title}',

content: [

new sap.m.Text({

text: 'content'

})

    ],

    buttons: [

new sap.m.Button({

text: 'test1'

}),

new sap.m.Button({

text: 'test2'

})

    ]

});

oDialog.open();


This one never calls the factory (there's no aggregation at all):


var oDialog = new sap.m.Dialog({

    title: '{i18n>sap.im.ui.datasource.browse.title}',

    content: [

new sap.m.Text({

text: 'content'

})

    ],

    buttons: {

path: '/myPath',

factory: function (){

return [

new sap.m.Button({

text: 'test1'

}),

new sap.m.Button({

text: 'test2'

})

]

}

    }

});

oDialog.open();


And this one doesn't work either:


var oDialog = new sap.m.Dialog({

title: '{i18n>sap.im.ui.datasource.browse.title}',

content: [

new sap.m.Text({

text: 'content'

})

    ]

});

oDialog.bindAggregation('buttons', '/myPath', function(){console.log('res')});

oDialog.open();



Does anyone of you have an idea what's going on here?

Tags:
Former Member replied

HI Marius :-)

From what I understand, this is the way to use factory in this context.

Example

Maybe you can tell us a little more about what you want to achieve, we can help.

-D

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question