Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

mojitProxy.config not being updated after mojtiProxy.refreshView #1046

Open
denchen opened this Issue · 1 comment

2 participants

@denchen

When setting ac.instance.config. after a call to mojitProxy.refreshView(), mojitProxy.config does not get updated to reflect new variable.

The relevant portions of my test code:

=== CONTROLLER ===

index: function(ac) {
    var refresh = ac.params.getFromMerged("refresh", undefined);
    if (refresh) {
        Y.log("Setting 'Refreshed!'", "debug", NAME);
        ac.instance.config.refreshtext = "Refreshed!";
    } else {
        Y.log("Setting 'Unrefreshed'", "debug", NAME);
        ac.instance.config.refreshtext = "Unrefreshed";
    }
    Y.log("Calling ac.done with ac.instance.config.refreshtext = " + ac.instance.config.refreshtext, "debug", NAME);
    ac.done();
}

=== BINDER ===

bind: function(node) {
    var me = this,
        button,
        inputfield;

    this.node = node;

    Y.log("Setting input field text to: " + this.mojitProxy.config.refreshtext, "debug", NAME);
    inputfield = node.one("#inputfield");
    inputfield.set('value', this.mojitProxy.config.refreshtext);

    Y.log("Adding button", "debug", NAME);
    button = new Y.Button({
    srcNode: "#refreshbutton",
        on: {
            'click': function () {
                Y.log("Button clicked!", "debug", NAME);
                this.mojitProxy.refreshView({
                    "params": {
                        "url": {
                            "refresh": 1
                        }
                    },
                    "rpc": true
                }, function(err, data) {
                    Y.log("Refresh view successful", "debug", NAME);
                });
            }.bind(this)
        }
    }).render();
},

onRefreshView: function (node, element) {
    Y.log("onRefreshView() called", "debug", NAME);
    this.bind(node, element);
}

=== VIEW ===

<div id="{{mojit_view_id}}">
<input id="inputfield" name="inputfield" />
<button id="refreshbutton" name="refreshbutton">Refresh Page</button>
</div>
@caridy caridy was assigned
@caridy
Owner

Workaround, from Yi:

In controller: ac.done(data, Y.mix(meta, {yourVar: xxx}));
In binder: 
mojitProxy.refreshView(params, function(data, meta) {
    var yourVar = meta.yourVar;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.