Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / examples / view / chooser-example.js
1 /*!
2  * Ext JS Library 3.0.3
3  * Copyright(c) 2006-2009 Ext JS, LLC
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 Ext.onReady(function(){\r
8     var chooser, btn;\r
9 \r
10     function insertImage(data){\r
11         Ext.DomHelper.append('images', {\r
12                 tag: 'img', src: data.url, style:'margin:10px;visibility:hidden;'\r
13         }, true).show(true).frame();\r
14         btn.focus();\r
15     };\r
16 \r
17     function choose(btn){\r
18         if(!chooser){\r
19                 chooser = new ImageChooser({\r
20                         url:'get-images.php',\r
21                         width:515,\r
22                         height:350\r
23                 });\r
24         }\r
25         chooser.show(btn.getEl(), insertImage);\r
26     };\r
27 \r
28     btn = new Ext.Button({\r
29             text: "Insert Image",\r
30                 handler: choose,\r
31         renderTo: 'buttons'\r
32     });\r
33 });\r