-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (52 loc) · 1.41 KB
/
index.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="dijit/themes/claro/claro.css">
</head>
<body class="claro">
<form data-dojo-type="dijit/form/Form" id="form">
<label>Text:
<input type="text" id="text" placeholder="Enter text to be added to the store" data-dojo-type="dijit/form/TextBox">
</label>
<button type="submit" id="submit" data-dojo-type="dijit/form/Button">
Add Text
</button>
</form>
<div id="list"></div>
<script src="dojoConfig.js"></script>
<script src="dojo/dojo.js"></script>
<script type="text/javascript">
require([
'dojo/parser',
'custom/store/TrackableMemoryStore',
'dijit/registry',
'custom/widget/ListWidget',
'dijit/form/Form',
'dijit/form/Button',
'dijit/form/TextBox',
'dojo/domReady!'
], function (parser, TrackableMemoryStore, registry, ListWidget) {
var store = new TrackableMemoryStore({
idProperty: 'id'
});
parser.parse();
var list = new ListWidget({
store: store
}, 'list').startup();
var submitButton = registry.byId('submit');
var textBox = registry.byId('text')
submitButton.on('click', function (event) {
// summary:
// add the entered text to the store and clear the text box
event.preventDefault();
store.add({
text: textBox.get('value')
});
textBox.set('value', '');
})
});
</script>
</body>
</html>