source: trunk/web/addons/job_monarch/lib/extjs/examples/grid-filtering/menu/EditableItem.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.3 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9Ext.menu.EditableItem = Ext.extend(Ext.menu.BaseItem, {
10    itemCls : "x-menu-item",
11    hideOnClick: false,
12   
13    initComponent: function(){
14      Ext.menu.EditableItem.superclass.initComponent.call(this);
15        this.addEvents('keyup');
16       
17                        this.editor = this.editor || new Ext.form.TextField();
18                        if(this.text) {
19                                this.editor.setValue(this.text);
20      }
21    },
22   
23    onRender: function(container){
24        var s = container.createChild({
25                cls: this.itemCls,
26                html: '<img src="' + this.icon + '" class="x-menu-item-icon" style="margin: 3px 3px 2px 2px;" />'
27        });
28       
29        Ext.apply(this.config, {width: 125});
30        this.editor.render(s);
31       
32        this.el = s;
33        this.relayEvents(this.editor.el, ["keyup"]);
34       
35        if(Ext.isGecko) {
36                        s.setStyle('overflow', 'auto');
37        }
38                       
39        Ext.menu.EditableItem.superclass.onRender.call(this, container);
40    },
41   
42    getValue: function(){
43        return this.editor.getValue();
44    },
45   
46    setValue: function(value){
47        this.editor.setValue(value);
48    },
49   
50    isValid: function(preventMark){
51        return this.editor.isValid(preventMark);
52    }
53});
Note: See TracBrowser for help on using the repository browser.