質問

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