Roo.bootstrap.Form = function(config){
+
Roo.bootstrap.Form.superclass.constructor.call(this, config);
Roo.bootstrap.Form.popover.apply();
*/
actioncomplete : true
});
-
};
Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component, {
f.clearInvalid();
});
-
-
return this;
},
Roo.each(el.items,function(e) {
iter(e);
});
-
-
};
iter(this);
return r;
-
}
});
// private
onLoad : function(ds, r, o)
{
- this.cursor = o.params ? o.params.start : 0;
+ this.cursor = o.params.start ? o.params.start : 0;
+
var d = this.getPageData(),
ap = d.activePage,
ps = d.pages;
* @cfg {Boolean} castInt (true|false) cast int if true (defalut true)
*/
castInt : true,
- /**
- * @cfg {Boolean} allowThousandsDelimiter (true|false) display thousands delimiter if true (e.g. "100,000") (defalut false)
- */
- allowThousandsDelimiter : false,
/**
* @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter
*/
- thousandsDelimiter : ",",
+ thousandsDelimiter : false,
/**
* @cfg {String} valueAlign alignment of value
*/
hiddenInput.name = this.name;
}
- //display field
- var inputConfig = this;
+ this.name = '';
- inputConfig.name = '';
+ var cfg = Roo.bootstrap.NumberField.superclass.getAutoCreate.call(this);
- var cfg = Roo.bootstrap.NumberField.superclass.getAutoCreate.call(inputConfig);
+ this.name = hiddenInput.name;
if(cfg.cn.length > 0) {
cfg.cn.push(hiddenInput);
allowed += "-";
}
- if(this.allowThousandsDelimiter) {
- allowed += this.thousandsDelimiter;
+ if(this.thousandsDelimiter) {
+ allowed += ",";
}
this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
parseValue : function(value)
{
- if(this.allowThousandsDelimiter) {
+ if(this.thousandsDelimiter) {
value += "";
- r = new RegExp(this.thousandsDelimiter, "g");
+ r = new RegExp(",", "g");
value = value.replace(r, "");
}
fixPrecision : function(value)
{
- if(this.allowThousandsDelimiter) {
+ if(this.thousandsDelimiter) {
value += "";
- r = new RegExp(this.thousandsDelimiter, "g");
+ r = new RegExp(",", "g");
value = value.replace(r, "");
}
this.hiddenEl().dom.value = (v === null || v === undefined ? '' : v);
- this.inputEl().dom.value = (this.allowThousandsDelimiter ? this.addThousandsDelimiter(v) : v);
+ this.inputEl().dom.value = Roo.util.Format.number(v, this.decimalPrecision,
+ this.thousandsDelimiter || ''
+ );
+
+ if(this.allowBlank && !v) {
+ this.inputEl().dom.value = '';
+ }
this.validate();
}
}
},
- addThousandsDelimiter : function(v)
- {
- if(!this.allowThousandsDelimiter) {
- return v;
- }
-
- v += "";
-
- var x = v.split(".");
-
- var x1 = x[0];
-
- var x2 = x.length > 1 ? "." + x[1] : "";
-
- var rgx = /(\d+)(\d{3})/;
-
- while (rgx.test(x1)) {
- x1 = x1.replace(rgx, "$1" + this.thousandsDelimiter + "$2");
- }
-
- return x1 + x2;
- },
-
hiddenEl : function()
{
return this.el.select('input.hidden-number-input',true).first();
/**
* @cfg {Number} decimalPrecision The maximum precision to display after the decimal separator (defaults to 2)
*/
- decimalPrecision : 2,
+ decimalPrecision : 0,
/**
* @cfg {Boolean} allowNegative False to prevent entering a negative sign (defaults to true)
*/
* value should be in lkey
*/
defaultCurrency : false,
+ /**
+ * @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter
+ */
+ thousandsDelimiter : false,
inputlg : 9,
autocomplete: 'new-password'
};
+ var hiddenInput = {
+ tag: 'input',
+ type: 'hidden',
+ id: Roo.id(),
+ cls: 'hidden-number-input'
+ };
+
if (this.name) {
- input.name = this.name;
+ hiddenInput.name = this.name;
}
if (this.disabled) {
cfg.cn = [
label,
- container
+ container,
+ hiddenInput
];
-
+
var settings = this;
['xs','sm','md','lg'].map(function(size){
});
return cfg;
-
},
initEvents : function()
this.initCurrencyEvent();
this.initNumberEvent();
-
},
initCurrencyEvent : function()
this.value = v;
if(this.rendered){
- this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+
+ this.hiddenEl().dom.value = (v === null || v === undefined ? '' : v);
+
+ this.inputEl().dom.value = Roo.util.Format.number(v, this.decimalPrecision,
+ this.thousandsDelimiter || ','
+ );
+
+ if(this.allowBlank && !v) {
+ this.inputEl().dom.value = '';
+ }
+
this.validate();
}
},
currencyEl : function()
{
return this.el.select('.roo-money-currency-input', true).first();
+ },
+
+ hiddenEl : function()
+ {
+ return this.el.select('input.hidden-number-input',true).first();
}
});
\ No newline at end of file