Skip to content


Live updating views #171

sweiz opened this Issue · 1 comment

1 participant


I'm attempting to update the views from outside the template, but the view will not reflect the changes to the model unless I re-render it;
var thisModel = new blade.model({"title": "Hello World"});
$('wrap').render('wrapView', thisModel, function() {
thisModel.set("title", "Hello Earth") // Doesn't update view unless I run render again.

Have tried;

model.add("clicks", 0);
var x = model.observable;
console.log(x.clicks); //calls model.get("clicks") and prints 0
x.clicks = 20; //calls model.set("clicks", 20)


var users = [ goes here... ];
var m = new blade.Model({"users": users});
//... Then later...
users[2].firstName = "Ben"; //This does not trigger Model.set or invalidate any contexts
//Nor does this...
m.observable.users[2].firstName = "Ben"; //This only calls Model.get
//To actually invalidate Contexts, you have to invoke Model.set... but wait...
m.set("users", users); //Oh, crap! Even this didn't work because the value was unchanged!
m.invalidate("users"); //Finally, it works! (invalidate() function was added in Blade 2.6.0)

from the wiki but neither seem to work unless I re-render the view. Am I missing something? Any help would be greatly appreciated.


It now works, and I don't know what I've done to make it work; quite likely I'm retarded. Please close this issue if possible.

Full props for blade, loving it!

@sweiz sweiz closed this
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.