forked from zhangguixu/sourcecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.html
More file actions
50 lines (47 loc) · 980 Bytes
/
view.html
File metadata and controls
50 lines (47 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo 1</title>
</head>
<body>
<div id="show"></div>
<script src="../lib/jquery-1.12.2.js"></script>
<script src="../lib/underscore.js"></script>
<script src="../lib/backbone.js"></script>
<script>
$(function(){
var stumodels = [{
Code : '1001',
Name : 'foo1',
Score : 530
},{
Code : '1002',
Name : 'foo2',
Score : 460
},{
Code : '1003',
Name : 'foo3',
Score : 660
},{
Code : '1004',
Name : 'foo4',
Score : 500
}];
var stulist = new Backbone.Collection(stumodels);
var stuview = Backbone.View.extend({
el : '#show',
render : function(){
var curlist = this.collection.models;
for(var i = 0; i < curlist.length; i++){
this.el.innerHTML += JSON.stringify(curlist[i])
+ '</br>';
}
}
});
var stuv = new stuview({collection : stulist});
stuv.render();
});
</script>
</body>
</html>