]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojox/dtl/demos/demo_Data.html
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dojox / dtl / demos / demo_Data.html
1 <html>
2         <head>
3                         <title>Demo using the dojo.data bind_data tag</title>
4             <script type="text/javascript" src="../../../dojo/dojo.js"
5                                 djConfig="isDebug: true, parseOnLoad: true"></script>
6             <script type="text/javascript" src="../../../dijit/dijit.js"></script> 
7             <script type="text/javascript">
8                                 dojo.require("dojox.dtl._Templated");
9                                 dojo.require("dojox.data.FlickrRestStore");
10                                 dojo.require("dojo.parser");
11
12                                 dojo.declare("demo.Gallery", [dijit._Widget, dojox.dtl._Templated], {
13                                         templatePath: dojo.moduleUrl("dojox.dtl.demos.templates", "gallery.html"),
14                                         store: new dojox.data.FlickrRestStore(),
15                                         selectThumbnail: function(e){
16                                                 this.selected = e.target.className;
17                                                 this.render();
18                                         },
19                                         keyUp: function(e){
20                                                 if(e.keyCode == dojo.keys.ENTER){
21                                                         var search = e.target.value;
22                                                         var query = {
23                                                                 query: {
24                                                                         userid: "44153025@N00",
25                                                                         apikey: "8c6803164dbc395fb7131c9d54843627",
26                                                                         sort: [
27                                                                                    {
28                                                                                         attribute: "interestingness",
29                                                                                         descending: true
30                                                                                         }
31                                                                         ],
32                                                                         tags: search.split(/\s*,\s*/g),
33                                                                         tag_mode: "any"
34                                                                 },
35                                                                 start: 0,
36                                                                 count: 10,
37                                                                 onBegin: dojo.hitch(this, function(total){
38                                                                         console.debug(total);
39                                                                         this._maxPhotos = total;
40                                                                 }),
41                                                                 onComplete: dojo.hitch(this, function(items, request){
42                                                                         console.debug(items);
43                                                                         if(items && items.length) {
44                                                                                 this.items = items;
45                                                                                 this.render();
46                                                                         }
47                                                                 })
48                                                         };
49                                                         this.store.fetch(query);
50                                                 }
51                                         }
52                                 });
53             </script>
54                         <body>
55                                 <div dojoType="demo.Gallery"></div>
56                         </body>
57         </head>
58 </html>