3 * @class Roo.bootstrap.MoneyField
4 * @extends Roo.bootstrap.ComboBox
5 * Bootstrap MoneyField class
8 * Create a new MoneyField.
9 * @param {Object} config Configuration options
12 Roo.bootstrap.MoneyField = function(config) {
14 Roo.bootstrap.MoneyField.superclass.constructor.call(this, config);
18 Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
27 getAutoCreate : function()
29 var align = this.labelAlign || this.parentLabelAlign();
41 cls : 'form-control roo-money-amount-input',
42 autocomplete: 'new-password'
46 input.name = this.name;
50 input.disabled = true;
53 var clg = 12 - this.inputlg;
54 var cmd = 12 - this.inputmd;
55 var csm = 12 - this.inputsm;
56 var cxs = 12 - this.inputxs;
60 cls : 'row roo-money-field',
64 cls : 'roo-money-currency column col-lg-' + clg + ' col-md-' + cmd + ' col-sm-' + csm + ' col-xs-' + cxs,
68 cls: 'roo-select2-container input-group',
72 cls : 'form-control roo-money-currency-input',
73 autocomplete: 'new-password'
77 cls : 'input-group-addon',
91 cls : 'roo-money-amount column col-lg-' + this.inputlg + ' col-md-' + this.inputmd + ' col-sm-' + this.inputsm + ' col-xs-' + this.inputxs,
95 cls: this.hasFeedback ? 'has-feedback' : '',
106 if (this.fieldLabel.length) {
109 tooltip: 'This field is required'
115 cls: 'control-label',
121 html: this.fieldLabel
124 indicator.cls = 'roo-required-indicator text-danger fa fa-lg fa-star left-indicator';
130 if(this.indicatorpos == 'right') {
131 indicator.cls = 'roo-required-indicator text-danger fa fa-lg fa-star right-indicator';
138 if(align == 'left') {
146 if(this.labelWidth > 12){
147 label.style = "width: " + this.labelWidth + 'px';
149 if(this.labelWidth < 13 && this.labelmd == 0){
150 this.labelmd = this.labelWidth;
152 if(this.labellg > 0){
153 label.cls += ' col-lg-' + this.labellg;
154 input.cls += ' col-lg-' + (12 - this.labellg);
156 if(this.labelmd > 0){
157 label.cls += ' col-md-' + this.labelmd;
158 container.cls += ' col-md-' + (12 - this.labelmd);
160 if(this.labelsm > 0){
161 label.cls += ' col-sm-' + this.labelsm;
162 container.cls += ' col-sm-' + (12 - this.labelsm);
164 if(this.labelxs > 0){
165 label.cls += ' col-xs-' + this.labelxs;
166 container.cls += ' col-xs-' + (12 - this.labelxs);
178 ['xs','sm','md','lg'].map(function(size){
179 if (settings[size]) {
180 cfg.cls += ' col-' + size + '-' + settings[size];
187 initEvents : function()
190 throw "can not find store for combo";
193 this.store = Roo.factory(this.store, Roo.data);
194 this.store.parent = this;
198 this.indicator = this.indicatorEl();
200 this.triggerEl = this.el.select('.input-group-addon', true).first();
202 this.triggerEl.on("click", this.onTriggerClick, this, { preventDefault : true });
204 this.currencyEl = this.el.select('.roo-money-currency-input', true).first();
206 this.amountEl = this.el.select('.roo-money-amount-input', true).first();
210 onTriggerClick : function(e)
217 this.loadNext = false;
219 if(this.isExpanded()){
223 Roo.log('run on trigger click');
224 if(this.triggerAction == 'all') {
225 this.doQuery(this.allQuery, true);
229 this.doQuery(this.getRawValue());
232 restrictHeight : function()
234 this.list.alignTo(this.currencyEl, this.listAlign);
235 this.list.alignTo(this.currencyEl, this.listAlign);