widgets/ComboBoxAdder.js
[Pman.Core] / widgets / ComboBoxAdder.js
1
2 //<script type="text/javascript">
3 /**
4  * 
5  * old combobox adder.. 
6  * this is all incorporated into the new combobox, however the API is different..
7  * 
8  * 
9  */
10
11
12
13
14
15 Ext.form.ComboBoxAdder = function(config){
16     
17     Ext.form.ComboBoxAdder.superclass.constructor.call(this, config);
18     this.on('select', function(cb, rec, ix) {
19         cb.lastData = rec.data;
20     });
21     this.addEvents({
22         'adderclick' : true
23     });
24 }
25  
26 Ext.extend(Ext.form.ComboBoxAdder, Ext.form.ComboBox, { 
27     lastData : false,
28     //onAddClick: function() { },
29     
30     onRender : function(ct, position) 
31     {
32         Ext.form.ComboBoxAdder.superclass.onRender.call(this, ct, position); 
33         this.adder = this.wrap.createChild(
34             {tag: 'img', src: Ext.BLANK_IMAGE_URL, cls: 'x-form-adder' });  
35         var _t = this;
36         this.adder.on('click', function(e) {
37             _t.fireEvent('adderclick', this, e);
38         }, _t);
39         //this.adder.on('click', this.onAddClick, _t);
40     }
41     
42 });
43
44
45
46 Ext.form.TextFieldAdder = function(config){
47     
48     Ext.form.TextFieldAdder.superclass.constructor.call(this, config);
49     this.on('select', function(cb, rec, ix) {
50         cb.lastData = rec.data;
51     });
52     this.addEvents({
53         'adderclick' : true
54     });
55 }
56  
57 Ext.extend(Ext.form.TextFieldAdder, Ext.form.TextField, { 
58     lastData : false,
59     //onAddClick: function() { },
60     
61     onRender : function(ct, position) 
62     {
63         Ext.form.TextFieldAdder.superclass.onRender.call(this, ct, position); 
64          this.wrap = this.el.wrap({cls: 'x-form-field-wrap'});
65         this.adder = this.wrap.createChild(
66             {tag: 'img', src: Ext.BLANK_IMAGE_URL, cls: 'x-form-textfield-adder'});  
67         var _t = this;
68         this.adder.on('click', function(e) {
69             _t.fireEvent('adderclick', this, e);
70         }, _t);
71     }
72     
73 });
74
75
76 Ext.form.TextFieldAdderMinus = function(config){
77     
78     Ext.form.TextFieldAdder.superclass.constructor.call(this, config);
79     this.on('select', function(cb, rec, ix) {
80         cb.lastData = rec.data;
81     });
82     this.addEvents({
83         'adderclick' : true,
84         'minusclick' : true
85     });
86 }
87  
88 Ext.extend(Ext.form.TextFieldAdderMinus, Ext.form.TextField, { 
89     lastData : false,
90     //onAddClick: function() { },
91     
92     onRender : function(ct, position) 
93     {
94         Ext.form.TextFieldAdder.superclass.onRender.call(this, ct, position); 
95          this.wrap = this.el.wrap({cls: 'x-form-field-wrap'});
96         this.adder = this.wrap.createChild(
97             {tag: 'img', src: Ext.BLANK_IMAGE_URL, width: 16, cls: 'x-form-textfield-adder'});  
98         this.minus = this.wrap.createChild(
99             {tag: 'img', src: Ext.BLANK_IMAGE_URL, width: 16, cls: 'x-form-textfield-minus'});  
100         var _t = this;
101         this.adder.on('click', function(e) {
102             _t.fireEvent('adderclick', this, e);
103         }, _t);
104         this.minus.on('click', function(e) {
105             _t.fireEvent('minusclick', this, e);
106         }, _t);
107     }
108     
109 });
110