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