Hi Isomorphic,
we are using SimpleTypes for formating numbers to various user-formats. In the beginning it worked great but now we encountered some problems:
Here and there we use the function formatCellValue to add measures or little icons to numbers. If we do so, the simpletype will be ignored. Is this the indended behavior?
For a sample we edited a part of your example-library
(girds->appearance->format values)
The decimal-point will be displayed as comma in the last column. If you activate the formatCellValue, the simletype will be ignored and you 'll see a decimal-dot.
we are using SimpleTypes for formating numbers to various user-formats. In the beginning it worked great but now we encountered some problems:
Here and there we use the function formatCellValue to add measures or little icons to numbers. If we do so, the simpletype will be ignored. Is this the indended behavior?
For a sample we edited a part of your example-library
(girds->appearance->format values)
Code:
isc.ClassFactory.defineClass("GsnumberItem", "TextItem"); isc.GsnumberItem.addProperties( { mapDisplayToValue : function(displayValue) { var value = displayValue.toString().replace(/\./g, ''); value = value.replace(/,/g, "."); if (isNaN(value)) return displayValue; if (value.length <= 0) return null; return parseFloat(value); }, mapValueToDisplay : function(internalValue) { if (internalValue == undefined || isNaN(internalValue)) return ''; else { var value = internalValue.toString().replace(/\./g, ","); var exp = new RegExp('(^\,-?[0-9]+)([0-9]{3})'); while (exp.test(value)) { value = value.replace(exp, "$1.$2"); } return value; } } }); isc.SimpleType.create( { name :"gsnumber", inheritsFrom :"float", normalDisplayFormatter : function(internalValue) { return this.shortDisplayFormatter(internalValue); }, shortDisplayFormatter : function(internalValue) { if (internalValue == undefined || isNaN(internalValue)) return ''; else { var value = internalValue.toString().replace(/\./g, ","); var exp = new RegExp('(^\,-?[0-9]+)([0-9]{3})'); while (exp.test(value)) { value = value.replace(exp, "$1.$2"); } return value; } }, editorType :"GsnumberItem" }); isc.ListGrid.create({ ID: "countryList", width:500, height:224, alternateRecordStyles:true, showAllRecords:true, data: countryData, fields:[ {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"}, {name:"countryName", title:"Country"}, {name:"independence", title:"Nationhood", type:"date", formatCellValue: function (value) { if (value) { return value.getShortMonthName()+' '+value.getDate()+', '+value.getFullYear(); } } }, {name:"gdp", title:"gdp", type:"gsnumber" //, formatCellValue: "value + ' I am a test'" } ] })
Comment