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