PDA

View Full Version : Boolean Fields Not Working in Inline Editor Grid



kyahne
1 Dec 2006, 12:17 PM
Not sure if this has been reported before, but I didn't see anything like it in the bug list. I've noticed that the Editor Grid does not seem to correctly read boolean values. For instance, your plants.xml example shows Marsh Marigold as having a value of indoor = false. However, on the grid, it shows as true when first initialized.

Perhaps this is a bug, perhaps I have just missed something obvious - this is my first day working with your examples.

Thanks so much!

tryanDLS
1 Dec 2006, 1:24 PM
It looks like it's just a bug in the example. In edit-grid.js change this since value is coming in as a string.



var formatBoolean = function(value){
return (value.toLowerCase() == 'true' ? 'Yes':'No');
}



also remove the

dataModel.addPreProcessor(4, Boolean) line a little further down. It looks like this is just passing true to the renderer in all cases.

Ernie
5 Dec 2006, 1:26 AM
I think it's rather the preprocessor which is causing trouble, because of the string value.

This worked for me:


var parseBoolean =function(value){
return (value.toLowerCase() == 'true' ? true:false);
};

dataModel.addPreprocessor(4, parseBoolean);


The rendering function is fine though.