3.2.0

Preserving Whitespaces

Is there anyway of preserving whitespaces when loading the grid? My data includes formatted currency (e.g. $ 1,234.56). The formatting includes whitespaces to make all the $ signs line up when using a fixed width font. Can this be done?

I am evaluating for an important application development project. This tool looks awesome and will fill our needs very well if I can clear up a few formatting issues.

Roberto A. Santiago
October 3,
You may try this trick - add $ sign wrapped in some html tag, for example, <b>$</b> and then position it to the left with CSS :-)

<style>
.aw-column-2, .aw-column-3 {text-align:right}
.aw-item-text b {position: absolute; top: 2px; left: 5px; font-weight: normal;}
</style>
<script>

    var num = new AW.Formats.Number;
    num.setTextFormat("<b>$</b> #,###.##");

    var obj = new AW.UI.Grid;

    obj.setCellData(function(col, row){return row * 12345});
    obj.setCellFormat(num, 2);

    obj.setColumnCount(10);
    obj.setRowCount(10);
    document.write(obj);

</script>


If this does not work, you'll have to write your own valueToText() method for custom AW.Formats.Number class.
Alex (ActiveWidgets)
October 4,
Awesome! Works like a charm. Many thanks. I will buy my license today.
Roberto A. Santiago
October 4,

This topic is archived.

See also:


Back to support forum