Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / chooser-example.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js">Ext.onReady(function(){\r
9     var chooser, btn;\r
10 \r
11     function insertImage(data){\r
12         Ext.DomHelper.append('images', {\r
13                 tag: 'img', src: data.url, style:'margin:10px;visibility:hidden;'\r
14         }, true).show(true).frame();\r
15         btn.focus();\r
16     };\r
17 \r
18     function choose(btn){\r
19         if(!chooser){\r
20                 chooser = new ImageChooser({\r
21                         url:'get-images.php',\r
22                         width:515,\r
23                         height:350\r
24                 });\r
25         }\r
26         chooser.show(btn.getEl(), insertImage);\r
27     };\r
28 \r
29     btn = new Ext.Button({\r
30             text: "Insert Image",\r
31                 handler: choose,\r
32         renderTo: 'buttons'\r
33     });\r
34 });\r
35 </pre>    \r
36 </body>\r
37 </html>