2
renderingContent:function(widget){
    uilayer.confirm("", this.renderingContextWidgetOnOkClick,this.contextChangeCancelHandler);
}

renderingContextWidgetOnOkClick:function(widget){
        console.log(widget);
}

How do I pass widget parameter which I get in renderContent function to the callback this.renderingContextWidgetOnOkClick which gets invoked on click of OK as I cannot call this.renderingContextWidgetOnOkClick(widget) as then the function gets invoked directly without ok clicked?

1 Answer 1

3

You can wrap it in a function

renderingContent:function(widget){
    uilayer.confirm("",   
        (function(that, widget){ 
            return function(){
                that.renderingContextWidgetOnOkClick(widget);
            };            
        })(this, widget),this.contextChangeCancelHandler);
}
Sign up to request clarification or add additional context in comments.

1 Comment

well done, but you forgot that the context will be switched to your function, so this will not be the object anymore. You must remember it before calling uilayer.confirm. Anyway, +

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.