bweinand
10-10-2006, 01:09 PM
First of all: Thank you so much for that awesome work :-) I have just included the grid into my application, and I am sure that my client will be more than happy with it. When changed the decimalSeparator to comma (,) the fractional part got lost when parsing the string to a float value because for javascript the decimal separator has to be point (.) for having the string correctly parsed. I have fixed the functions for the NumberEditor and the Money renderer. Only 3 lines of code - I hope it helps and I would be glad to see your work going on and on and on :-)
YAHOO.ext.grid.NumberEditor.prototype.show = function(){
this.element.dom.title = '';
// Fix decimalSeparator
this.element.dom.value = this.element.dom.value.replace(".", YAHOO.ext.grid.NumberEditor.prototype.decimalSepar ator);
YAHOO.ext.grid.NumberEditor.prototype.getValue = function(){
if(!this.validate()){
return this.originalValue;
}else{
var value = this.element.dom.value;
// Fix decimalSeparator
value = value.replace(YAHOO.ext.grid.NumberEditor.prototyp e.decimalSeparator, ".");
var formatMoney = function(value){
value -= 0;
value = (Math.round(value*100))/100;
value = (value == Math.floor(value)) ? value + '.00' : ( (value*10 == Math.floor(value*10)) ? value + '0' : value);
// Fix decimalSeparator
return value.toString().replace(".", YAHOO.ext.grid.NumberEditor.prototype.decimalSepar ator) + " ";
};
YAHOO.ext.grid.NumberEditor.prototype.show = function(){
this.element.dom.title = '';
// Fix decimalSeparator
this.element.dom.value = this.element.dom.value.replace(".", YAHOO.ext.grid.NumberEditor.prototype.decimalSepar ator);
YAHOO.ext.grid.NumberEditor.prototype.getValue = function(){
if(!this.validate()){
return this.originalValue;
}else{
var value = this.element.dom.value;
// Fix decimalSeparator
value = value.replace(YAHOO.ext.grid.NumberEditor.prototyp e.decimalSeparator, ".");
var formatMoney = function(value){
value -= 0;
value = (Math.round(value*100))/100;
value = (value == Math.floor(value)) ? value + '.00' : ( (value*10 == Math.floor(value*10)) ? value + '0' : value);
// Fix decimalSeparator
return value.toString().replace(".", YAHOO.ext.grid.NumberEditor.prototype.decimalSepar ator) + " ";
};