PDA

View Full Version : Bug when decimalSeparator other than .



bweinand
10 Oct 2006, 9:09 AM
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.decimalSeparator);

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.prototype.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.decimalSeparator) + " €";
};

jack.slocum
10 Oct 2006, 11:15 AM
Thank you for reporting this issue. It makes a lot of sense. I have added it to my bug list and it will be corrected in the next release.

Thanks!

Jack

jbowman
10 Oct 2006, 12:04 PM
don't suppose you'd be interested in making the bug list available? Maybe some of us can jump in and help squish them :)

jack.slocum
10 Oct 2006, 2:01 PM
They are all fixed. :) I fix them as they are reported, that makes it easy to do releases as needed. I would definitely like the help though! If you are really interested, I can set up the source on sourceforge so it has a remote CVS.

jbowman
10 Oct 2006, 6:17 PM
I'm not sure how much help I personally would be, as I'm learning javascript as I go with this project I'm working on. But if I come up with stuff to contribute, I'll gladly do so. If anything I'll get more experience in working in a multi-developer environment with javascript. Do you have a plan for things you want to accomplish with the toolkit?

I know I plan on extending your toolbar once I finish up this dynamic "widgets" system I'm working on. I'm thinking about trying to make it a bit more like the upcoming Word interface with ribbons and labels for the different sections. I could start there after I finish up my widgets.

If others are interested, I'd say do it. You've done A LOT and I'm sure lots of people are profiting from it in their work environment. Why not give them a chance to contribute back :)