BUG 9106 "Enmascaramiento en grillas no permite decimales." SOLVED

- Percentage field defined with an mask does not allow decimal in grids
- comma_separator attribute included in the code
This commit is contained in:
Victor Saisa Lopez
2012-06-08 16:02:27 -04:00
parent 188d538c52
commit 2954bb0c05
2 changed files with 23 additions and 7 deletions

View File

@@ -1365,7 +1365,7 @@ function G_Percentage( form, element, name )
var me=this; var me=this;
this.parent = G_Text; this.parent = G_Text;
this.parent( form, element, name); this.parent( form, element, name);
this.validate = 'Int'; //this.validate = 'Int'; //Commented for allow enter the character '.'
this.mType = 'percentage'; this.mType = 'percentage';
this.mask= '###.##'; this.mask= '###.##';
this.comma_separator = "."; this.comma_separator = ".";
@@ -1377,7 +1377,7 @@ function G_Currency( form, element, name )
var me=this; var me=this;
this.parent = G_Text; this.parent = G_Text;
this.parent( form, element, name); this.parent( form, element, name);
//this.validate = 'Int'; //commented for allow enter the character '.' //this.validate = 'Int'; //Commented for allow enter the character '.'
this.mType = 'currency'; this.mType = 'currency';
this.mask= '_###,###,###,###,###;###,###,###,###,###.00'; this.mask= '_###,###,###,###,###;###,###,###,###,###.00';
this.comma_separator = "."; this.comma_separator = ".";

View File

@@ -60,26 +60,41 @@ var G_Grid = function(oForm, sGridName){
j++; j++;
} }
break; break;
case 'currency': case 'currency':
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) { while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
this.aElements.push(new G_Currency(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + '][' this.aElements.push(new G_Currency(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + ']['
+ this.aFields[i].sFieldName)); + this.aFields[i].sFieldName));
if (aFields[i].oProperties) {
this.aElements[this.aElements.length - 1].mask = aFields[i].oProperties.mask; if (this.aFields[i].oProperties) {
if (this.aFields[i].oProperties.comma_separator) {
this.aElements[this.aElements.length - 1].comma_separator = this.aFields[i].oProperties.comma_separator;
}
this.aElements[this.aElements.length - 1].mask = this.aFields[i].oProperties.mask;
} }
j++; j++;
} }
break; break;
case 'percentage': case 'percentage':
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) { while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
this.aElements.push(new G_Percentage(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j this.aElements.push(new G_Percentage(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j
+ '][' + this.aFields[i].sFieldName)); + '][' + this.aFields[i].sFieldName));
if (aFields[i].oProperties) {
this.aElements[this.aElements.length - 1].mask = aFields[i].oProperties.mask; if (this.aFields[i].oProperties) {
if (this.aFields[i].oProperties.comma_separator) {
this.aElements[this.aElements.length - 1].comma_separator = this.aFields[i].oProperties.comma_separator;
}
this.aElements[this.aElements.length - 1].mask = this.aFields[i].oProperties.mask;
} }
j++; j++;
} }
break; break;
case 'dropdown': case 'dropdown':
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) { while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
this.aElements.push(new G_DropDown(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + '][' this.aElements.push(new G_DropDown(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + ']['
@@ -90,6 +105,7 @@ var G_Grid = function(oForm, sGridName){
j++; j++;
} }
break; break;
default: default:
while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) { while (oAux = document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']')) {
this.aElements.push(new G_Field(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + '][' this.aElements.push(new G_Field(oForm, document.getElementById('form[' + this.sGridName + '][' + j + '][' + this.aFields[i].sFieldName + ']'), this.sGridName + '][' + j + ']['
@@ -99,7 +115,7 @@ var G_Grid = function(oForm, sGridName){
} }
j++; j++;
} }
break; break;
} }
} }
// Set dependent fields // Set dependent fields