Loading ...
Sorry, an error occurred while loading the content.

How can I get DataTable.formatCurrency() to use GBP instead of USD?

Expand Messages
  • jeremy.hoke@ymail.com
    Hello - I m using the currency formatter for one of the fields in my DataTable, but the default unit is USD ($), and I d like it to be GBP (£). Is there a
    Message 1 of 3 , Jan 2, 2009
    • 0 Attachment
      Hello -

      I'm using the "currency" formatter for one of the fields in my DataTable, but the default unit is USD ($), and I'd like it to be GBP (£).

      Is there a way to override the default in the DataTable.formatCurrency() formatter?

      If not, could someone show me how I'd go about writing a custom formatter and using that instead of the built-in one?

      Here's some of the code that I've been working with:

      var myColumnDefs = [
      {key: 'intProductId',label: 'ID',formatter: 'number',sortable: false,resizeable: true},
      {key: 'strProductTitle',label: 'Title',sortable: false,resizeable: true},
      {key: 'strProductCode',label: 'Product Code',sortable: false,resizeable: true},
      {key: 'strManufacturerCode',label: 'Manufacturer\'s Code',sortable: false,resizeable: true},
      {key: 'strBrandName',label: 'Brand',sortable: false,resizeable: true},
      {key: 'flProductPrice',label: 'Price',formatter: 'currency',sortable: false,resizeable: true}
      ];

      myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get('accounts'));

      myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;

      myDataSource.responseSchema = {
      fields: [
      {key: 'intProductId', parser: 'number'},
      {key: 'strProductTitle'},
      {key: 'strProductCode'},
      {key: 'strManufacturerCode'},
      {key: 'strBrandName'},
      {key: 'flProductPrice', parser: parseNumberFromCurrency}
      ]
      };

      myDataTable = new YAHOO.widget.DataTable('markup', myColumnDefs, myDataSource, {});



      Thanks,
      Jeremy


    • Satyam
      Now there is, see: http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_currencyOptions Satyam
      Message 2 of 3 , Jan 2, 2009
      • 0 Attachment
        Now there is, see:

        http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_currencyOptions

        Satyam


        jeremy.hoke@... wrote:
        > Hello -
        >
        > I'm using the "currency" formatter for one of the fields in my
        > DataTable, but the default unit is USD ($), and I'd like it to be GBP (£).
        >
        > Is there a way to override the default in the
        > DataTable.formatCurrency() formatter?
        >
        > If not, could someone show me how I'd go about writing a custom
        > formatter and using that instead of the built-in one?
        >
        > Here's some of the code that I've been working with:
        >
        > var myColumnDefs = [
        > {key: 'intProductId',label: 'ID',formatter: 'number',sortable: false,resizeable: true},
        > {key: 'strProductTitle',label: 'Title',sortable: false,resizeable: true},
        > {key: 'strProductCode',label: 'Product Code',sortable: false,resizeable: true},
        > {key: 'strManufacturerCode',label: 'Manufacturer\'s Code',sortable: false,resizeable: true},
        > {key: 'strBrandName',label: 'Brand',sortable: false,resizeable: true},
        > {key: 'flProductPrice',label: 'Price',formatter: 'currency',sortable: false,resizeable: true}
        > ];
        >
        > myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get('accounts'));
        >
        > myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
        >
        > myDataSource.responseSchema = {
        > fields: [
        > {key: 'intProductId', parser: 'number'},
        > {key: 'strProductTitle'},
        > {key: 'strProductCode'},
        > {key: 'strManufacturerCode'},
        > {key: 'strBrandName'},
        > {key: 'flProductPrice', parser: parseNumberFromCurrency}
        > ]
        > };
        >
        > myDataTable = new YAHOO.widget.DataTable('markup', myColumnDefs, myDataSource, {});
        >
        >
        >
        > Thanks,
        > Jeremy
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.176 / Virus Database: 270.10.2/1872 - Release Date: 02/01/2009 13:10
        >
        >
      • jeremy.hoke@ymail.com
        Awesome, thanks for that!!! ... http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_currencyOptions ... GBP (�). ... false,resizeable:
        Message 3 of 3 , Jan 2, 2009
        • 0 Attachment
          Awesome, thanks for that!!!

          --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          > Now there is, see:
          >
          >
          http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_currencyOptions
          >
          > Satyam
          >
          >
          > jeremy.hoke@... wrote:
          > > Hello -
          > >
          > > I'm using the "currency" formatter for one of the fields in my
          > > DataTable, but the default unit is USD ($), and I'd like it to be
          GBP (�).
          > >
          > > Is there a way to override the default in the
          > > DataTable.formatCurrency() formatter?
          > >
          > > If not, could someone show me how I'd go about writing a custom
          > > formatter and using that instead of the built-in one?
          > >
          > > Here's some of the code that I've been working with:
          > >
          > > var myColumnDefs = [
          > > {key: 'intProductId',label: 'ID',formatter: 'number',sortable:
          false,resizeable: true},
          > > {key: 'strProductTitle',label: 'Title',sortable:
          false,resizeable: true},
          > > {key: 'strProductCode',label: 'Product Code',sortable:
          false,resizeable: true},
          > > {key: 'strManufacturerCode',label: 'Manufacturer\'s
          Code',sortable: false,resizeable: true},
          > > {key: 'strBrandName',label: 'Brand',sortable:
          false,resizeable: true},
          > > {key: 'flProductPrice',label: 'Price',formatter:
          'currency',sortable: false,resizeable: true}
          > > ];
          > >
          > > myDataSource = new
          YAHOO.util.DataSource(YAHOO.util.Dom.get('accounts'));
          > >
          > > myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
          > >
          > > myDataSource.responseSchema = {
          > > fields: [
          > > {key: 'intProductId', parser: 'number'},
          > > {key: 'strProductTitle'},
          > > {key: 'strProductCode'},
          > > {key: 'strManufacturerCode'},
          > > {key: 'strBrandName'},
          > > {key: 'flProductPrice', parser: parseNumberFromCurrency}
          > > ]
          > > };
          > >
          > > myDataTable = new YAHOO.widget.DataTable('markup', myColumnDefs,
          myDataSource, {});
          > >
          > >
          > >
          > > Thanks,
          > > Jeremy
          > >
          > >
          > >
          ------------------------------------------------------------------------
          > >
          > >
          > > No virus found in this incoming message.
          > > Checked by AVG - http://www.avg.com
          > > Version: 8.0.176 / Virus Database: 270.10.2/1872 - Release Date:
          02/01/2009 13:10
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.