I've been working on trying to understand how numbers and currency formats
work.
I've got dates working nicely now and can override default display either in
the <body> tag:

<body ex:formats="currency { decimal-digits: 2 }
                  date { template: 'dd MMM yyyy'}"
                  >

or in tabular views or tables within tabular views.

I thought I should be able to do the same thing with currency (and number)
formats but it's eluding me!

I have a schema valueType of number on my currency field because I wanted to
use a NumericRange facet to bracket. This facet works fine. So the
.tranamount field is being treated as a number.

I have a table view defined like this:

          <!-- EASY TABLE View -->
        <div ex:role="exhibit-view"
             ex:viewClass="Exhibit.TabularView"
             ex:columns=".custnumber, .custname, .label, .trandate,
.tranamount, .paiddate, .daysoutstanding"
             ex:columnLabels="Customer, Name, Inv No, Inv Date, Amount, Date
Paid, Days"
             ex:columnFormats="list, list, list, date, currency, date {
template: 'dd/MM/yyyy' }, number"
             ex:rowStyler="zebraStyler">
        </div>

The dates work fine (ie: .trandate appears as 01 Mar 2008, .paiddate appears
as 01/03/2008).
The .tranamount field however is not working as expected. It does convert
numbers like 594.0 to 594.00 but there is no $ dollar sign and numbers like
13720.85 appear without the thousands comma and with no $ sign. After
searching the mailing list I've loaded in some javascript code mentioned a
few times (the reassignment of
Exhibit.Formatter._NumberFormatter.prototype.formatText and the addCommas
function). 

Any comments on what I'm doing wrong here?


I have also got a tabular view that is making use of a HTML table so I can
right align the .tranamount field and justify other columns easier. It is
defined like this:

          <!-- CONTROLLED TABLE View -->
        <div ex:role="view" ex:viewClass="Tabular"
             ex:formats="date { template: 'dd/MM/yyyy' } currency {
decimal-digits: 2 }"     
             ex:columns=".custnumber, .custname, .trandate, .paiddate,
.daysoutstanding, .label, .tranamount, .ontime"
             ex:columnFormats="list, list, date, date, number, list,
currency, list"    
             ex:columnLabels="Customer, Name, Inv Date, Paid Date, Days, Inv
No, Amount, Classification">
          <table>
             <tr>
                <td width="10%" ex:content=".custnumber"></td>
                <td width="30%" ex:content=".custname"></td>
                <td width="10%" ex:content=".trandate"></td>
                <td width="10%" ex:content=".paiddate"></td>
                <td width="7%" ex:content=".daysoutstanding"></td>
                <td width="7%" ex:content=".label"></td>
                <td width="10%" ex:content=".tranamount" align="right"></td>
                <td width="16%" ex:content=".ontime"></td>
             </tr>
          </table>
        </div>

The date override format is working here but not the currency one. It
doesn't do what I expected with the .tranamount field. ie: 594.0 appears as
594.0 (no two decimal place and no $ sign, and 13720.85 appears right
justified as 13,720.85 - it's added the comma but no $ sign.

Any comments to give me a better clue here?

The example is inside our firewall but I'd be happy to email the html and
it's small JSON file that shows the problem. 

Sorry for the long post. Any help would be appreciated.

Peter Frederick
IT Manager,  Riverina Australia Pty Ltd
Email: [EMAIL PROTECTED]  
Phone: (07) 3007-6836

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to