I have a SAPUI5 table binded with the simple model. I'm printing the data using Table control of SAPUI5. I'm binding the name field with the name column of the table control and on the next column I have a button. When you press this button I'd like to perform some operation on the model (read) however I can't figure out a way of getting the instance of the model in the callback function for the button.

Here's the JSBin to reproduce the problem.

有帮助吗?

解决方案

Here's the answer to the problem thanks to a user from SAP community.

JSBin

Here's the updated code for the press event handler that resolves the current model

var button = new sap.ui.commons.Button({
    text: "Button",
    press: function (e) {
        var model = this.getModel();
        var path = e.getSource().getBindingContext().getPath();
        var obj = model.getProperty(path);
        console.log(obj);
    }
});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top