Created
March 28, 2013 10:26
-
-
Save bagobor/5262212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src='/js/libs/jquery-1.7.2.min.js'></script> | |
<script src='/js/libs/underscore.js'></script> | |
<script src='/js/libs/backbone.js'></script> | |
</head> | |
<body> | |
<div class='test'>Test</div> | |
<button class='btn'>Update</button> | |
<script> | |
var p = { | |
projects : { | |
el : ['list', 'tasks'] | |
} | |
}; | |
var data = {}; | |
$(document).ready(function(){ | |
var DocumentRow = Backbone.View.extend({ | |
el: '.test', | |
initialize: function() { | |
this.$el.data('view', this); | |
}, | |
render: function() { | |
this.$el.html( "Update from View" ); | |
} | |
}); | |
var view = new DocumentRow(); | |
$('.btn').click(function() { | |
$('.test').data('view').render(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment