Code:
isc.defineClass("ExtendedListGrid", isc.ListGrid); isc.ExtendedListGrid.addProperties({ fieldIsNumeric : function (field) { var type = field.type, isNumber = false; while (!isNumber && type != null) { if (type == "integer" || type == "float") isNumber = true; var simpleType = isc.SimpleType.getType(field.type); type = simpleType && simpleType.inheritsFrom; } return isNumber; }, draw : function () { // In RTL mode, force numeric fields to be right-aligned if (isc.Page.isRTL()) { var fields = this.fields || []; for (var i = 0; i < fields.length; i++) { if (this.fieldIsNumeric(fields[i])) { fields[i].align="left"; fields[i].cellAlign="left"; } } } return this.Super("draw", arguments); } });
Obviously you'll want a better name than "ExtendedListGrid", this was just for demonstration. Also you'll note that we're setting the alignment to "left" even though we actually want "right". This is because in RTL mode, by default field alignment is always flipped from whatever is explicitly specified. You can disable this behavior by setting reverseRTLAlign to false on the grid in question
Regards
Isomorphic Software
Leave a comment: