mojito
mojito copied to clipboard
mojitProxy.config not being updated after mojtiProxy.refreshView
When setting ac.instance.config.
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>
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;
});