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"> |
---|
7 | dojo.require("dijit._WidgetBase"); |
---|
8 | dojo.require("dojox.dtl._Templated"); |
---|
9 | dojo.require("dojox.data.FlickrRestStore"); |
---|
10 | dojo.require("dojo.parser"); |
---|
11 | |
---|
12 | dojo.declare("demo.Gallery", [dijit._WidgetBase, dojox.dtl._Templated], { |
---|
13 | templateString: dojo.cache("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 | </head> |
---|
55 | <body> |
---|
56 | <p>Also see demo_Tree.html for an alternative way to use data stores.</p> |
---|
57 | <div dojoType="demo.Gallery"></div> |
---|
58 | </body> |
---|
59 | </html> |
---|